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:buildcraftAdditions.client.gui.GuiFluidicCompressor.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;
    drawFluid(fluidicCompressor.getFluid(), fluidicCompressor.getScaledLiquid(52), j + 53, k + 16, 16, 52);
    mc.renderEngine.bindTexture(texture);
    drawTexturedModalRect(j + 52, k + 21, 176, 21, 16, 58);
    if (fluidicCompressor.fill) {
        drawTexturedModalRect(j + 20, k + 25, 195, 83, 19, 16);
        drawTexturedModalRect(j + 20, k + 45, 176, 99, 19, 16);
    } else {//from  w  ww. j  a v a 2s.  c o  m
        drawTexturedModalRect(j + 20, k + 45, 195, 99, 19, 16);
        drawTexturedModalRect(j + 20, k + 25, 176, 83, 19, 16);
    }
    drawTexturedModalRect(j + 89, k + 53, 176, 3, fluidicCompressor.getProgress(), 4);

}

From source file:buildcraftAdditions.client.gui.GuiHeatedFurnace.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 + 34, 176, 14, furnace.getScaledProgress(), 16);
}

From source file:buildcraftAdditions.client.gui.GuiKEB.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);
    long percent = ((long) keb.energy * 248) / keb.maxEnergy;

    drawTexturedModalRect(guiLeft + 67, guiTop + 30, 176, 162, 47, 47);
    if (primed)/*w  w w.ja  v  a 2s.  c o m*/
        teller--;
    if (teller <= 0) {
        teller = 30;
        yellow = !yellow;
    }

    if (yellow) {
        if (!green)
            drawTexturedModalRect(guiLeft + 67, guiTop + 30, 176, 115, 47, 47);
        else
            drawTexturedModalRect(guiLeft + 67, guiTop + 30, 176, 209, 47, 47);
    }

    int temp = (int) percent;
    if (temp > 36)
        temp = 36;
    drawTexturedModalRect(guiLeft + 90, guiTop + 17, 215, 42, temp, 11);
    percent -= 36;
    if (percent <= 0)
        return;
    temp = (int) percent;
    if (temp > 62)
        temp = 62;
    drawTexturedModalRect(guiLeft + 115, guiTop + 28, 241, 53, 11, temp);
    percent -= 62;
    if (percent <= 0)
        return;
    temp = (int) percent;
    if (temp > 61)
        temp = 61;
    drawTexturedModalRect(guiLeft + 115 - temp, guiTop + 79, 241 - temp, 104, temp, 11);
    percent -= 61;
    if (percent <= 0)
        return;
    temp = (int) percent;
    if (percent > 62)
        temp = 62;
    drawTexturedModalRect(guiLeft + 54, guiTop + 79 - temp, 180, 104 - temp, 11, temp);
    percent -= 62;
    if (percent <= 0)
        return;
    drawTexturedModalRect(guiLeft + 65, guiTop + 17, 191, 42, (int) percent, 11);

}

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

License:GNU General Public License

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
}

From source file:buildcraftAdditions.client.gui.widgets.WidgetBase.java

License:GNU General Public License

public void render() {
    float shade = enabled ? 1.0F : 0.2F;
    GL11.glColor4f(shade, shade, shade, shade);
    gui.bindTexture(textures[textureIndex]);
    gui.drawTexturedModalRect(x, y, u, v, width, height);
}

From source file:buildcraftAdditions.client.gui.widgets.WidgetButtonText.java

License:GNU General Public License

@Override
public void render(int mouseX, int mouseY) {
    if (!shouldRender)
        return;/*  www.  j a va  2 s  . c o m*/
    int t = 6;
    ResourceLocation centerPiece = MIDDLE;
    if (getBounds().contains(mouseX, mouseY)) {
        centerPiece = MIDDLEHOVER;
    }
    while (t < width - 6) {
        RenderUtils.drawImage(centerPiece, x + t, y, 1, height);
        t++;
    }
    RenderUtils.drawImage(RIGHT, x + width - 6, y, 6, height);
    RenderUtils.drawImage(LEFT, x, y, 6, height);
    if (getBounds().contains(mouseX, mouseY)) {
        RenderUtils.drawImage(MIDDLESIDEHOVER, x + 6, y, 1, height);
        RenderUtils.drawImage(MIDDLESIDEHOVER, x + width - 6, y, 1, height);
    }
    gui.drawString(text, x + 8, y + 3, color);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:buildcraftAdditions.client.gui.widgets.WidgetImage.java

License:GNU General Public License

@Override
public void render(int mouseX, int mouseY) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderUtils.drawImage(texture, x, y, width, height);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:buildcraftAdditions.client.models.ModelKineticDuster.java

License:GNU General Public License

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    this.cube.render(f5);
    this.shape11_2.render(f5);
    GL11.glPushMatrix();//from   w  w  w .ja v  a 2  s.  c om
    GL11.glTranslatef(this.shape24_3.offsetX, this.shape24_3.offsetY, this.shape24_3.offsetZ);
    GL11.glTranslatef(this.shape24_3.rotationPointX * f5, this.shape24_3.rotationPointY * f5,
            this.shape24_3.rotationPointZ * f5);
    GL11.glScaled(1.0D, 6.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_3.offsetX, -this.shape24_3.offsetY, -this.shape24_3.offsetZ);
    GL11.glTranslatef(-this.shape24_3.rotationPointX * f5, -this.shape24_3.rotationPointY * f5,
            -this.shape24_3.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_3.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    this.shape11_7.render(f5);
    this.shape11_5.render(f5);
    this.shape11_1.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_1.offsetX, this.shape24_1.offsetY, this.shape24_1.offsetZ);
    GL11.glTranslatef(this.shape24_1.rotationPointX * f5, this.shape24_1.rotationPointY * f5,
            this.shape24_1.rotationPointZ * f5);
    GL11.glScaled(1.0D, 6.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_1.offsetX, -this.shape24_1.offsetY, -this.shape24_1.offsetZ);
    GL11.glTranslatef(-this.shape24_1.rotationPointX * f5, -this.shape24_1.rotationPointY * f5,
            -this.shape24_1.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_1.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_2.offsetX, this.shape24_2.offsetY, this.shape24_2.offsetZ);
    GL11.glTranslatef(this.shape24_2.rotationPointX * f5, this.shape24_2.rotationPointY * f5,
            this.shape24_2.rotationPointZ * f5);
    GL11.glScaled(1.0D, 6.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_2.offsetX, -this.shape24_2.offsetY, -this.shape24_2.offsetZ);
    GL11.glTranslatef(-this.shape24_2.rotationPointX * f5, -this.shape24_2.rotationPointY * f5,
            -this.shape24_2.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_2.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_5.offsetX, this.shape24_5.offsetY, this.shape24_5.offsetZ);
    GL11.glTranslatef(this.shape24_5.rotationPointX * f5, this.shape24_5.rotationPointY * f5,
            this.shape24_5.rotationPointZ * f5);
    GL11.glScaled(14.0D, 1.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_5.offsetX, -this.shape24_5.offsetY, -this.shape24_5.offsetZ);
    GL11.glTranslatef(-this.shape24_5.rotationPointX * f5, -this.shape24_5.rotationPointY * f5,
            -this.shape24_5.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_5.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    this.shape11_4.render(f5);
    this.shape11_3.render(f5);
    this.shape11_6.render(f5);
    this.shape11.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24.offsetX, this.shape24.offsetY, this.shape24.offsetZ);
    GL11.glTranslatef(this.shape24.rotationPointX * f5, this.shape24.rotationPointY * f5,
            this.shape24.rotationPointZ * f5);
    GL11.glScaled(14.0D, 6.0D, 1.0D);
    GL11.glTranslatef(-this.shape24.offsetX, -this.shape24.offsetY, -this.shape24.offsetZ);
    GL11.glTranslatef(-this.shape24.rotationPointX * f5, -this.shape24.rotationPointY * f5,
            -this.shape24.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_4.offsetX, this.shape24_4.offsetY, this.shape24_4.offsetZ);
    GL11.glTranslatef(this.shape24_4.rotationPointX * f5, this.shape24_4.rotationPointY * f5,
            this.shape24_4.rotationPointZ * f5);
    GL11.glScaled(14.0D, 6.0D, 1.0D);
    GL11.glTranslatef(-this.shape24_4.offsetX, -this.shape24_4.offsetY, -this.shape24_4.offsetZ);
    GL11.glTranslatef(-this.shape24_4.rotationPointX * f5, -this.shape24_4.rotationPointY * f5,
            -this.shape24_4.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_4.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.BucketItemRenderer.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemBucketBCA))
        return;//from   w  w  w . ja  v  a  2s  . c  o m

    ItemBucketBCA bucket = (ItemBucketBCA) item.getItem();
    Fluid fluid = null;
    boolean gaseous = false;

    if (bucket.getFluid() != null) {
        fluid = bucket.getFluid().getFluid();
        if (fluid != null && (fluid.isGaseous() || fluid.getDensity() < 0))
            gaseous = true;
    }

    IIcon overlay = bucket.getOverlay();
    IIcon bucketIcon = Items.bucket.getIconFromDamage(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glTranslated(-0.5, -0.9, 0);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.075, 0.475, 0);
            GL11.glScaled(0.85, 0.85, 0.85);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    }

    if (fluid != null) {
        Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);
        renderMask(overlay, fluid.getIcon(), type, gaseous);
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);

    if (!type.equals(ItemRenderType.INVENTORY)) {
        if (gaseous)
            ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMaxU(), bucketIcon.getMinV(),
                    bucketIcon.getMinU(), bucketIcon.getMaxV(), bucketIcon.getIconWidth(),
                    bucketIcon.getIconHeight(), 0.0625F);
        else
            ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMinU(), bucketIcon.getMaxV(),
                    bucketIcon.getMaxU(), bucketIcon.getMinV(), bucketIcon.getIconWidth(),
                    bucketIcon.getIconHeight(), 0.0625F);
    } else
        renderIcon(bucketIcon, 0, gaseous);

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.BucketItemRenderer.java

License:GNU General Public License

private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type, boolean flip) {
    if (mask == null || subIcon == null)
        return;/*from ww  w. j  a v a 2  s.  com*/

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_CULL_FACE);
    Tessellator tessellator = Tessellator.instance;

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, 1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, 0.001, flip);
    else
        preRenderWorldIcon(mask, 0.001, flip);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, -1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, -0.0635, flip);
    else
        preRenderWorldIcon(mask, -0.0635, flip);
    tessellator.draw();

    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET);
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDepthMask(false);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, 1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, 0.001, flip);
    else
        preRenderWorldIcon(subIcon, 0.001, flip);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, -1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, -0.0635, flip);
    else
        preRenderWorldIcon(subIcon, -0.0635, flip);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glColor4f(1, 1, 1, 1);
}