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:butchery.client.GuiTub.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    int texture = mc.renderEngine.getTexture("/butchery/gui/tub.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(texture);
    int x = (this.width - this.xSize) / 2;
    int y = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    int waterLevel = this.tubEntity.getWaterLevelScaled(53);
    this.drawTexturedModalRect(x + 66, y + 53 + 17 - waterLevel, 176, 23, 3, waterLevel);
    int soakProgress = this.tubEntity.getSoakProgressScaled(18);
    this.drawTexturedModalRect(x + 75, y + 18 + 35 - soakProgress, 176, 4 + 18 - soakProgress, 18,
            soakProgress);/*from   www  .j  a v a2 s .  c o m*/
}

From source file:ccm.autoCrafter2000.guis.AutoCrafterGui.java

License:Open Source License

/**
 * Draw the background layer for the GuiContainer (everything behind the items)
 *//*from  ww w. j a v  a2 s .c  om*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}

From source file:ccm.burialservices.client.renderers.GraveRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tickTime) {
    GraveTE te = (GraveTE) tileentity;/*w w w  .  j  a  va 2 s.  co m*/

    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z); //Center to block

    ResourceLocation skin = te.getLocationSkin();

    float f5 = 0.9F;
    float f6 = 0.0625F;

    switch (te.getBlockMetadata()) {
    case 0:
        break;
    case 1:
        GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(-1, 0, 0);
        break;
    case 2:
        GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(-1, 0, -1);
        break;
    case 3:
        GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(0, 0, -1);
        break;
    }

    GL11.glTranslated(0.5, 0.1d, 0.5);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glScalef(f6, f6, f6);

    Minecraft.getMinecraft().renderEngine.bindTexture(skin);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);

    MODEL_BIPED.bipedHead.rotateAngleX = (float) Math.toRadians(15F);
    MODEL_BIPED.bipedHead.render(f5);
    MODEL_BIPED.bipedBody.render(f5);
    MODEL_BIPED.bipedRightArm.render(f5);
    MODEL_BIPED.bipedLeftArm.render(f5);
    MODEL_BIPED.bipedRightLeg.render(f5);
    MODEL_BIPED.bipedLeftLeg.render(f5);

    GL11.glPopMatrix();

    ItemStack is = te.getHolding();
    if (is != null) {
        renderItemHolding(0, te.getBlockMetadata(), is, x, y, z, tickTime);
        if (is.getItem().requiresMultipleRenderPasses()) {
            for (int i = 1; i < is.getItem().getRenderPasses(is.getItemDamage()); i++) {
                renderItemHolding(i, te.getBlockMetadata(), is, x, y, z, tickTime);
            }
        }
    }

    renderSign(x, y, z, tickTime, te.text, te.getBlockMetadata(), is != null);
}

From source file:ccm.burialservices.client.renderers.GraveRenderer.java

License:Open Source License

private void renderSign(double x, double y, double z, float tickTime, String[] signText, int meta,
        boolean renderingItem) {
    if (signText.length == 0)
        return;//from ww w  . ja  v  a  2 s .  co  m
    int i = 0;
    for (String line : signText)
        if (!Strings.isNullOrEmpty(line)) {
            i++;
        }
    if (i == 0)
        return;

    GL11.glPushMatrix();
    float f1 = 0.6666667F;
    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.75F * f1, (float) z + 0.5F);
    float f2 = 0.0F;

    switch (meta) {
    case 0:
        break;
    case 1:
        f2 = 90f;
        break;
    case 2:
        f2 = 180f;
        break;
    case 3:
        f2 = -90f;

    }
    GL11.glTranslated(0, -0.3, 0);
    if (renderingItem)
        GL11.glTranslated(0, 0.03, 0);

    GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslated(0, -1.2, 0);

    GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
    GL11.glTranslatef(0f, 0.8F, 0.5f);
    MODEL_SIGN.signStick.showModel = false;

    this.bindTexture(SIGN_TEXTURE);
    GL11.glPushMatrix();
    GL11.glScalef(f1, -f1, -f1);
    MODEL_SIGN.renderSign();
    GL11.glPopMatrix();
    FontRenderer fontrenderer = this.getFontRenderer();
    f2 = 0.016666668F * f1;
    GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
    GL11.glScalef(f2, -f2, f2);
    GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2);
    GL11.glDepthMask(false);
    byte b0 = 0;

    for (int j = 0; j < signText.length; ++j) {
        GL11.glPushMatrix();
        String s = signText[j];
        int width = fontrenderer.getStringWidth(s);
        if (width > 95) {
            float f = 1f - ((width) * 0.0015f);
            GL11.glScalef(f, f, f);
        }
        fontrenderer.drawString(s, -width / 2, j * 10 - 20, b0);
        GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:ccm.placeableTools.client.ToolRenderer.java

License:Open Source License

private void renderSign(double x, double y, double z, float tickTime, int facing, String[] signText, int meta) {
    GL11.glPushMatrix();//from   w w w  .jav a 2  s. c  o  m
    float f1 = 0.6666667F;
    float f2 = 0.0F;

    switch (facing) {
    case 0:
    case 8:
        f2 = -90f;
        break;
    case 1:
    case 7:
        f2 = 90f;
        break;
    case 2:
    case 5:
        f2 = 180f;
    }

    if (meta >= 2) {
        GL11.glTranslated(0, -1.2, 0);
    }

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.75F * f1, (float) z + 0.5F);
    GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);

    GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
    GL11.glTranslatef(0f, 0.8F, 0.5f);
    MODEL_SIGN.signStick.showModel = false;

    if (facing > 4) {
        if (meta >= 2)
            GL11.glTranslated(-0.6, 0, 0);
        //GL11.glTranslated(b ? -0.4 : -0.6, 0, 0);

        if (meta == 2 && facing == 7)
            GL11.glTranslated(1.2, 0, 0);
        else if (meta == 3 && facing == 8)
            GL11.glTranslated(1.2, 0, 0);
        else if (meta == 4 && facing == 6)
            GL11.glTranslated(1.2, 0, 0);
        else if (meta == 5 && facing == 5)
            GL11.glTranslated(1.2, 0, 0);
    }

    this.bindTexture(SIGN_TEXTURE);
    GL11.glPushMatrix();
    GL11.glScalef(f1, -f1, -f1);
    MODEL_SIGN.renderSign();
    GL11.glPopMatrix();
    FontRenderer fontrenderer = this.getFontRenderer();
    f2 = 0.016666668F * f1;
    GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
    GL11.glScalef(f2, -f2, f2);
    GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2);
    GL11.glDepthMask(false);
    byte b0 = 0;

    for (int j = 0; j < signText.length; ++j) {
        GL11.glPushMatrix();
        String s = signText[j];
        int width = fontrenderer.getStringWidth(s);
        if (width > 95) {
            float f = 1f - ((width) * 0.0015f);
            GL11.glScalef(f, f, f);
        }
        fontrenderer.drawString(s, -width / 2, j * 10 - signText.length * 5, b0);
        GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:ccm.placeableTools.client.ToolRenderer.java

License:Open Source License

public static void doRenderPass(int i, int meta, ItemStack stack, double x, double y, double z) {
    Icon icon = stack.getItem().getIcon(stack, i);

    if (icon == null)
        return;/*from w ww .  ja  v  a 2 s  .co m*/

    GL11.glPushMatrix();
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber()));
    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslated(x, y, z); //Center to block
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glTranslatef(-0.5f, .5f, 0.5f); // Center on block

    if (stack.getItem() instanceof ItemSpade || stack.getItem() instanceof ItemHoe) {
        float shift = 0.3f;
        switch (ForgeDirection.values()[meta]) {
        case NORTH:
            GL11.glTranslatef(0, 0, -shift);
            GL11.glRotatef(15f, -0.5f, 0, 0);
            break;
        case SOUTH:
            GL11.glTranslatef(0, 0, shift);
            GL11.glRotatef(-15f, -0.5f, 0, 0);
            break;
        case EAST:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            GL11.glTranslatef(0, 0, shift);
            GL11.glRotatef(-15f, -0.5f, 0, 0);
            break;
        case WEST:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            GL11.glTranslatef(0, 0, -shift);
            GL11.glRotatef(15f, -0.5f, 0, 0);
            break;
        case DOWN:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            break;
        }
        GL11.glTranslatef(0, 0, -0.03f); //Icon depth of the shovel
        GL11.glRotatef(180f, 1, 0, 0);
    } else if (stack.getItem() instanceof ItemAxe || stack.getItem() instanceof ItemPickaxe) {
        float shift = 0.15f;
        switch (ForgeDirection.values()[meta]) {
        case NORTH:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        case SOUTH:
            GL11.glRotatef(-90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, -1);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        case EAST:
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        case WEST:
            GL11.glRotatef(180f, 0, 1, 0);
            GL11.glTranslatef(-2, 0, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        }
        GL11.glTranslatef(0, 0, 0.03F);
    } else if (stack.getItem() instanceof ItemSword) {
        float shift = 0.15f;
        switch (ForgeDirection.values()[meta]) {
        case NORTH:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            GL11.glTranslatef(-1, 0, 1);
            break;
        case SOUTH:
            GL11.glRotatef(-90f, 0, 1, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            GL11.glTranslatef(-1, 0, -1);
            break;
        case EAST:
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            GL11.glTranslatef(-1, 1, 0);
            break;
        case WEST:
            GL11.glRotatef(180f, 0, 1, 0);
            GL11.glTranslatef(-1, 1, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            break;
        case UP:
            GL11.glRotatef(180f, 1, 0, 0);
            GL11.glTranslatef(1, 0, 1);
            GL11.glRotatef(90f, 0, 1, 0);
            break;
        case DOWN:
            GL11.glRotatef(180f, 1, 0, 0);
            break;
        }
        GL11.glTranslatef(-0.05f, 0, 0.03F);
    }
    GL11.glRotatef(-45f, 0, 0, 1);
    GL11.glScalef(1.5f, 1.5f, 1.5f);
    ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
            icon.getIconWidth(), icon.getIconHeight(), 0.06F / 1.5f);

    if (stack.hasEffect(i)) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        texturemanager.bindTexture(RES_ITEM_GLINT);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:cd4017be.automation.Gui.GuiDetector.java

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(new ResourceLocation("automation", "textures/gui/detector.png"));
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    for (int i = 0; i < 6; i++) {
        this.drawTexturedModalRect(this.guiLeft + 7, this.guiTop + 15 + i * 18, 176,
                18 * (tileEntity.getMode(i) & 3), 18, 18);
        this.drawTexturedModalRect(this.guiLeft + 25, this.guiTop + 15 + i * 18, 194,
                18 * (tileEntity.getSide(i) % 6), 18, 18);
        if ((tileEntity.getMode(i) & 4) != 0)
            this.drawTexturedModalRect(this.guiLeft + 65, this.guiTop + 15 + i * 18, 212, 0, 10, 18);
        if (tileEntity.getState(i))
            this.drawTexturedModalRect(this.guiLeft + 151, this.guiTop + 15 + i * 18, 212, 18, 10, 18);
    }/*from  www .j a v a  2  s .com*/
    for (int i = 0; i < 6; i++)
        values[i].drawTextBox();
    this.drawStringCentered(tileEntity.getInventoryName(), this.guiLeft + this.xSize / 2, this.guiTop + 4,
            0x404040);
    this.drawStringCentered("Inventory", this.guiLeft + this.xSize / 2, this.guiTop + 126, 0x404040);
}

From source file:cd4017be.automation.Gui.GuiFluidUpgrade.java

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(new ResourceLocation("automation", "textures/gui/fluidUpgrade.png"));
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    if ((this.container.inventory.upgrade.mode & 1) != 0)
        this.drawTexturedModalRect(this.guiLeft + 16, this.guiTop + 15, 185, 0, 9, 18);
    if ((this.container.inventory.upgrade.mode & 2) != 0)
        this.drawTexturedModalRect(this.guiLeft + 7, this.guiTop + 15, 176, 0, 9, 18);
    if ((this.container.inventory.upgrade.mode & 4) != 0)
        this.drawTexturedModalRect(this.guiLeft + 161, this.guiTop + 15,
                (this.container.inventory.upgrade.mode & 8) != 0 ? 202 : 194, 0, 8, 18);
    this.drawStringCentered("" + this.container.inventory.upgrade.maxAmount, this.guiLeft + 129,
            this.guiTop + 20, 0x404040);
    this.drawStringCentered(this.container.inventory.getInventoryName(), this.guiLeft + this.xSize / 2,
            this.guiTop + 4, 0x404040);
    this.drawStringCentered("Inventory", this.guiLeft + this.xSize / 2, this.guiTop + 36, 0x404040);
}

From source file:cd4017be.automation.Gui.GuiFluidVent.java

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(new ResourceLocation("automation", "textures/gui/fluidVent.png"));
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    if ((tileEntity.netData.ints[0] & 0x100) != 0)
        this.drawTexturedModalRect(this.guiLeft + 183, this.guiTop + 73, 226, 0, 18, 18);
    this.drawLiquidTank(tileEntity.tanks, 0, 184, 16, true);
    this.drawLiquidConfig(tileEntity, -18, 7);
    this.drawStringCentered("Inventory", this.guiLeft + 88, this.guiTop + 4, 0x404040);
    this.drawStringCentered("Vent", this.guiLeft + 201, this.guiTop + 4, 0x404040);
    int n = tileEntity.netData.ints[0] & 0xff;
    this.drawStringCentered(n == 0 ? "off" : "" + n, this.guiLeft + 210, this.guiTop + 78, 0x404040);
    //this.drawStringCentered(String.format("X= %d , Y= %d , Z= %d", (byte)tileEntity.netData.ints[1], (byte)(tileEntity.netData.ints[1] >> 8), (byte)(tileEntity.netData.ints[1] >> 16)), this.guiLeft + this.xSize / 2, this.guiTop + this.ySize, 0xffffff);
}

From source file:cd4017be.automation.Gui.GuiItemMatterInterface.java

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(new ResourceLocation("automation", "textures/gui/matterInterface.png"));
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    int n = list.length <= 6 ? 0 : scroll * 40 / (list.length - 6);
    this.drawTexturedModalRect(this.guiLeft + 160, this.guiTop + 16 + n, 176, 0, 8, 12);
    for (int i = scroll; i < scroll + 6 && i < list.length; i++) {
        fontRendererObj.drawString(String.format("%d %s", list[i].stackSize, list[i].getDisplayName()),
                this.guiLeft + 70, this.guiTop + 17 + (i - scroll) * 8, 0x7fffff);
    }/*from   ww w  .ja  v a 2  s  .co  m*/
    this.drawStringCentered(amount > 0 ? "" + amount : "All", this.guiLeft + 16, this.guiTop + 52, 0x808040);
    this.drawStringCentered(this.container.inventory.getInventoryName(), this.guiLeft + this.xSize / 2,
            this.guiTop + 4, 0x404040);
    this.drawStringCentered("Inventory", this.guiLeft + this.xSize / 2, this.guiTop + 72, 0x404040);
}