Example usage for org.lwjgl.opengl GL11 glColor4f

List of usage examples for org.lwjgl.opengl GL11 glColor4f

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glColor4f.

Prototype

public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);

Source Link

Document

Float version of #glColor4b Color4b

Usage

From source file:buildcraft.transport.gui.GuiGateInterface.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    container.synchronize();/* ww w . j a v  a  2s.  co m*/

    ResourceLocation texture = container.getGateGuiFile();

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(texture);

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    int triggerTracker = 0;
    boolean allTriggersActive = true;
    for (AdvancedSlot slot : slots) {
        if (slot instanceof TriggerSlot) {
            boolean active = container.triggerState[triggerTracker++];
            if (slot.isDefined() && ((TriggerSlot) slot).getTrigger() != null && !active) {
                allTriggersActive = false;
                break;
            }
        }
    }

    triggerTracker = 0;
    for (int s = 0; s < slots.length; ++s) {
        AdvancedSlot slot = slots[s];

        if (slot instanceof TriggerSlot) {
            ITrigger trigger = ((TriggerSlot) slot).getTrigger();
            boolean halfWidth = pipe.gate.logic == GateDefinition.GateLogic.AND && !allTriggersActive;

            if (pipe.gate.material.hasParameterSlot) {

                if (container.triggerState[triggerTracker++]) {
                    mc.renderEngine.bindTexture(texture);

                    drawTexturedModalRect(cornerX + slot.x + 35, cornerY + slot.y + 6, 176, 18,
                            halfWidth ? 9 : 18, 4);
                }

                if (trigger == null || !trigger.hasParameter()) {
                    mc.renderEngine.bindTexture(texture);

                    drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y - 1, 176, 0, 18, 18);
                }
            } else if (container.triggerState[triggerTracker++]) {
                mc.renderEngine.bindTexture(texture);

                drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y + 6, 176, 18, halfWidth ? 9 : 18,
                        4);
            }
        } else if (slot instanceof TriggerParameterSlot) {
            TriggerParameterSlot paramSlot = (TriggerParameterSlot) slot;
            TriggerSlot trigger = (TriggerSlot) slots[s - numSlots * 2];

            if (trigger.isDefined() && trigger.getTrigger().requiresParameter()) {
                if (paramSlot.getItemStack() == null) {
                    mc.renderEngine.bindTexture(texture);

                    drawTexturedModalRect(cornerX + slot.x - 1, cornerY + slot.y - 1, 176, 22, 18, 18);
                }
            }
        }
    }

    drawBackgroundSlots();
}

From source file:buildcraft.transport.GuiDiamondPipe.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/filter.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(i);/*from  w w  w  .  ja  v a2  s  .  c  o  m*/
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

    drawBackgroundSlots();
}

From source file:buildcraft.transport.GuiGateInterface.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    _container.synchronize();/*w  w  w .  ja  v  a  2  s . c o m*/
    int texture = 0;

    texture = mc.renderEngine.getTexture(_container.getGateGuiFile());

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(texture);
    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    for (int s = 0; s < slots.length; ++s) {
        AdvancedSlot slot = slots[s];

        if (slot instanceof TriggerSlot) {
            ITrigger trigger = ((TriggerSlot) slot).getTrigger();

            if (_container.getGateOrdinal() >= GateKind.AND_3.ordinal()) {
                ITriggerParameter parameter = null;

                if (slots[s + nbEntries * 2] != null && slots[s + nbEntries * 2].isDefined())
                    parameter = ((TriggerParameterSlot) slots[s + nbEntries * 2]).getTriggerParameter();

                if (_container.isNearbyTriggerActive(trigger, parameter)) {
                    mc.renderEngine.bindTexture(texture);

                    drawTexturedModalRect(cornerX + slot.x + 35, cornerY + slot.y + 6, 176, 18, 18, 4);
                }

                if (trigger == null || !trigger.hasParameter()) {
                    mc.renderEngine.bindTexture(texture);

                    drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y - 1, 176, 0, 18, 18);
                }
            } else if (_container.isNearbyTriggerActive(trigger, null)) {
                mc.renderEngine.bindTexture(texture);

                drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y + 6, 176, 18, 18, 4);
            }
        }
    }

    drawBackgroundSlots();
}

From source file:buildcraft.transport.render.TileEntityPickupFX.java

License:Minecraft Mod Public

@Override
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5,
        float par6, float par7) {
    float var8 = (this.age + par2) / this.maxAge;
    var8 *= var8;
    double var9 = this.entityToPickUp.posX;
    double var11 = this.entityToPickUp.posY;
    double var13 = this.entityToPickUp.posZ;
    double var15 = this.entityPickingUp.xCoord + 0.5;
    double var17 = this.entityPickingUp.yCoord + yOffs;
    double var19 = this.entityPickingUp.zCoord + 0.5;
    double var21 = var9 + (var15 - var9) * var8;
    double var23 = var11 + (var17 - var11) * var8;
    double var25 = var13 + (var19 - var13) * var8;
    int var30 = this.getBrightnessForRender(par2);
    int var31 = var30 % 65536;
    int var32 = var30 / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var31 / 1.0F, var32 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    var21 -= interpPosX;
    var23 -= interpPosY;
    var25 -= interpPosZ;
    if (RenderManager.instance.renderEngine != null) {
        RenderManager.instance.renderEntityWithPosYaw(this.entityToPickUp, var21, var23, var25,
                this.entityToPickUp.rotationYaw, par2);
    }//from   ww w  .jav  a 2  s .co  m
}

From source file:buildcraft.transport.RenderPipe.java

License:Minecraft Mod Public

public void doRenderItem(IPipedItem entityitem, double d, double d1, double d2, float f1) {

    if (entityitem == null || entityitem.getItemStack() == null)
        return;/*from ww  w .ja  v a  2 s.  c  om*/

    ItemStack itemstack = entityitem.getItemStack();
    random.setSeed(187L);

    GL11.glPushMatrix();

    byte quantity = 1;
    if (entityitem.getItemStack().stackSize > 1)
        quantity = 2;

    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);

    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.ENTITY);

    if (customRenderer != null) {

        GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC
        loadTexture("/terrain.png");
        ForgeHooksClient.overrideTexture(itemstack.getItem());
        float f4 = 0.25F;
        f4 = 0.5F;
        GL11.glScalef(f4, f4, f4);

        for (int j = 0; j < quantity; j++) {

            GL11.glPushMatrix();

            if (j > 0) {
                float f5 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f7 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                GL11.glTranslatef(f5, f7, f9);
            }

            RenderPipe.dummyEntityItem.item = itemstack;

            customRenderer.renderItem(ItemRenderType.ENTITY, itemstack, renderBlocks,
                    RenderPipe.dummyEntityItem);
            GL11.glPopMatrix();
        }

    } else if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null
            && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) {

        GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC
        loadTexture("/terrain.png");
        ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
        float f4 = 0.25F;
        int j = Block.blocksList[itemstack.itemID].getRenderType();
        if (j == 1 || j == 19 || j == 12 || j == 2)
            f4 = 0.5F;

        GL11.glScalef(f4, f4, f4);
        for (int k = 0; k < quantity; k++) {
            GL11.glPushMatrix();

            if (k > 0) {
                float f6 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f11 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                GL11.glTranslatef(f6, f9, f11);
            }

            float f7 = 1.0F;
            renderBlocks.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), f7);
            GL11.glPopMatrix();
        }

    } else {
        GL11.glTranslatef(0, 0.10F, 0); // BC SPECIFIC

        if (itemstack.getItem().requiresMultipleRenderPasses()) {
            GL11.glScalef(0.5F, 0.5F, 0.5F);
            this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]));

            for (int i = 0; i <= 1; ++i) {
                int iconIndex = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(),
                        i);
                float scale = 1.0F;

                if (true) {
                    int var17 = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(),
                            i);
                    float var18 = (var17 >> 16 & 255) / 255.0F;
                    float var19 = (var17 >> 8 & 255) / 255.0F;
                    float var20 = (var17 & 255) / 255.0F;
                    GL11.glColor4f(var18 * scale, var19 * scale, var20 * scale, 1.0F);
                }

                this.drawItem(iconIndex, quantity);
            }
        } else {

            GL11.glScalef(0.5F, 0.5F, 0.5F);
            int i = itemstack.getIconIndex();
            if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null) {
                loadTexture("/terrain.png");
                ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
            } else {
                loadTexture("/gui/items.png");
                ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]);
            }

            drawItem(i, quantity);
        }

    }
    GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.TileEntityPickupFX.java

License:Minecraft Mod Public

@Override
public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) {
    float f6 = (field_678_p + f) / field_677_q;
    f6 *= f6;//from  w w w. j  a  v  a 2s .  c  o m
    double d = field_675_a.posX;
    double d1 = field_675_a.posY;
    double d2 = field_675_a.posZ;
    double d3 = field_679_o.xCoord + 0.5;
    double d4 = field_679_o.yCoord + yDestination;
    double d5 = field_679_o.zCoord + 0.5;
    double d6 = d + (d3 - d) * f6;
    double d7 = d1 + (d4 - d1) * f6;
    double d8 = d2 + (d5 - d2) * f6;
    int i = MathHelper.floor_double(d6);
    int j = MathHelper.floor_double(d7 + (yOffset / 2.0F));
    int k = MathHelper.floor_double(d8);
    float f7 = worldObj.getLightBrightness(i, j, k);
    d6 -= interpPosX;
    d7 -= interpPosY;
    d8 -= interpPosZ;
    GL11.glColor4f(f7, f7, f7, 1.0F);

    if (RenderManager.instance.renderEngine != null)
        RenderManager.instance.renderEntityWithPosYaw(field_675_a, (float) d6, (float) d7, (float) d8,
                field_675_a.rotationYaw, f);
}

From source file:buildcraftAdditions.client.gui.gui.GuiBase.java

License:GNU General Public License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(texture());/* ww  w. j a va 2 s  .  com*/
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, tileGuiYSize);

    if (drawPlayerInv) {
        bindTexture(PLAYER_INV_TEXTURE);
        drawTexturedModalRect(guiLeft, guiTop + tileGuiYSize, 0, 0, xSizePlayerInv, ySizePlayerInv);
    }
    bindTexture(texture());
    drawBackgroundPreWidgets(f, x, y);

    if (shouldDrawWidgets)
        drawWidgets(x, y);
    bindTexture(texture());

    drawBackgroundPostWidgets(f, x, y);
}

From source file:buildcraftAdditions.client.gui.GuiBase.java

License:GNU General Public License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(texture());/*from  w w  w  . j  a  v  a2  s  .c  o m*/
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

    if (drawPlayerInv) {
        bindTexture(PLAYER_INV_TEXTURE);
        drawTexturedModalRect(guiLeft, guiTop + ySize, 0, 0, xSizePlayerInv, ySizePlayerInv);
    }

    for (WidgetBase widget : widgets)
        widget.render();
}

From source file:buildcraftAdditions.client.gui.GuiBasicCoil.java

License:GNU General Public License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j + 79, k + 28 + (16 - coil.getBurnIconHeight()), 176, 16 - coil.getBurnIconHeight(),
            16, coil.getBurnIconHeight());
}

From source file:buildcraftAdditions.client.gui.GuiChargingStation.java

License:GNU General Public License

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}