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:com.professorvennie.machinerycraft.core.helpers.RenderHelper.java

License:Creative Commons License

public static void renderTooltip(int x, int y, List<String> tooltipData, int color, int color2) {
    boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING);
    if (lighting)
        net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();

    if (!tooltipData.isEmpty()) {
        int var5 = 0;
        int var6;
        int var7;
        FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
        for (var6 = 0; var6 < tooltipData.size(); ++var6) {
            var7 = fontRenderer.getStringWidth(tooltipData.get(var6));
            if (var7 > var5)
                var5 = var7;
        }//from   w w  w . j  av a  2 s .c  o m
        var6 = x + 12;
        var7 = y - 12;
        int var9 = 8;
        if (tooltipData.size() > 1)
            var9 += 2 + (tooltipData.size() - 1) * 10;
        float z = 300F;
        drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2);
        drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2);
        drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2);
        drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2);
        drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2);
        int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216;
        drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12);
        drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12);
        drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color);
        drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12);

        GL11.glDisable(GL11.GL_DEPTH_TEST);
        for (int var13 = 0; var13 < tooltipData.size(); ++var13) {
            String var14 = tooltipData.get(var13);
            fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
            if (var13 == 0)
                var7 += 2;
            var7 += 10;
        }
        GL11.glEnable(GL11.GL_DEPTH_TEST);
    }
    if (!lighting)
        net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
    GL11.glColor4f(1F, 1F, 1F, 1F);
}

From source file:com.professorvennie.machinerycraft.machines.windmill.GuiWindmilll.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1F, 1F, 1F, 1F);
    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

    int i = this.windmill.getPowerScaled(45);
    drawTexturedModalRect(guiLeft + 80, guiTop + 21 + 45 - i, 176, 45 - i, 16, i);

}

From source file:com.projectzed.mod.gui.component.GuiClearButton.java

License:Open Source License

@Override
public void drawButton(Minecraft minecraft, int x, int y) {
    if (this.visible) {
        FontRenderer fontrenderer = minecraft.fontRenderer;
        GL11.glColor4f(1f, 1f, 1f, 1f);
        Minecraft.getMinecraft().getTextureManager().bindTexture(this.TEXTURE);

        calc = width * this.PIXEL;

        this.TESS.startDrawingQuads();

        this.TESS.addVertexWithUV(xPosition, yPosition, 0, 0, 0);// bottom left texture
        this.TESS.addVertexWithUV(xPosition, yPosition + height, 0, 0, calc);// top left
        this.TESS.addVertexWithUV(xPosition + width, yPosition + height, 0, calc, calc);// top right
        this.TESS.addVertexWithUV(xPosition + width, yPosition, 0, calc, 0);// bottom right

        this.TESS.draw();

        this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2,
                this.yPosition + (this.height - 8) / 2, 0xffffffff);
    }//from  w  w w .j  av a2 s  .  co  m
}

From source file:com.rakosmanjr.heliostatpower.client.gui.machine.GuiIonicCompressor.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(Textures.GUI_IONIC_COMPRESSOR_TEXTURE);
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;
    this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}

From source file:com.rakosmanjr.heliostatpower.client.gui.machine.GuiMetalWorker.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1F, 1F, 1F, 1F);
    mc.renderEngine.bindTexture(Textures.GUI_METAL_WORKER_TEXTURE);
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;
    drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);

    if (basicMetalWorker.miller.IsMachineProcessing()) {
        int progress = basicMetalWorker.miller.GetNormalizedProgress(millerArrow.getWidth());

        drawTexturedModalRect(millerArrow.getX() + xStart, millerArrow.getY() + yStart, baseArrow.getX(),
                baseArrow.getY(), progress, baseArrow.getHeight());
    }//from  ww  w .  j  av a2s.  co m

    if (basicMetalWorker.drawer.IsMachineProcessing()) {
        int progress = basicMetalWorker.drawer.GetNormalizedProgress(drawerArrow.getWidth());

        drawTexturedModalRect(drawerArrow.getX() + xStart, drawerArrow.getY() + yStart, baseArrow.getX(),
                baseArrow.getY(), progress, baseArrow.getHeight());
    }
}

From source file:com.redthirddivision.mc.waffle.gui.GuiWaffleIron.java

License:Apache License

@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(texture);
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

    if (this.tileentity.itemTime < 200) {
        int bar = (200 - this.tileentity.itemTime) * 24 / 200;
        this.drawTexturedModalRect(k + 79, l + 34, 176, 14, bar + 1, 16);
    }//from   w ww  .ja  v a2  s .  c o  m
}

From source file:com.rvantwisk.cnctools.controls.opengl.PlatformActor.java

License:Open Source License

@Override
public void initialize() {

    display_list = GL11.glGenLists(1);//from  w  w  w. j a v  a  2  s  .com

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    // draw the grid
    GL11.glBegin(GL11.GL_LINES);

    for (int i = xneg; i <= xpos; i += openNess) {
        setColor(i);
        GL11.glVertex3f(i, yneg, ZPOS);
        GL11.glVertex3f(i, ypos, ZPOS);
    }

    for (int i = yneg; i <= ypos; i += openNess) {
        setColor(i);
        GL11.glVertex3f(xneg, i, ZPOS);
        GL11.glVertex3f(xpos, i, ZPOS);
    }

    GL11.glColor4f(color_fill[0], color_fill[1], color_fill[2], color_fill[3]);
    GL11.glRectf(xneg, yneg, xpos, ypos);
    GL11.glEnd();

    GL11.glEndList();
}

From source file:com.rvantwisk.cnctools.controls.opengl.PlatformActor.java

License:Open Source License

/**
 * Decide what color to use//from  www.ja v a2  s  . c  om
 *
 * @param i
 */
private void setColor(int i) {
    if (i % seps == 0) {
        GL11.glColor4f(color_grads_major[0], color_grads_major[1], color_grads_major[2], color_grads_major[3]);
    } else if (i % (seps / 2) == 0) {
        GL11.glColor4f(color_grads_interm[0], color_grads_interm[1], color_grads_interm[2],
                color_grads_interm[3]);
    } else {
        GL11.glColor4f(color_grads_minor[0], color_grads_minor[1], color_grads_minor[2], color_grads_minor[3]);
    }
}

From source file:com.samrj.devil.graphics.GraphicsUtil.java

public static void glColor(Vec4 v) {
    GL11.glColor4f(v.x, v.y, v.z, v.w);
}

From source file:com.savageboy74.savagetech.client.render.tileentity.TileEntityRendererLootBox.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    if (tileEntity instanceof TileEntityLootBox) {
        TileEntityLootBox tileEntityLootBox = (TileEntityLootBox) tileEntity;
        ForgeDirection direction = null;

        if (tileEntityLootBox.getWorldObj() != null) {
            direction = tileEntityLootBox.getOrientation();
        }//w  ww . jav  a 2s. com

        this.bindTexture(Textures.Model.LOOT_BOX);
        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short angle = 0;

        if (direction != null) {
            if (direction == ForgeDirection.NORTH) {
                angle = 180;
            } else if (direction == ForgeDirection.SOUTH) {
                angle = 0;
            } else if (direction == ForgeDirection.WEST) {
                angle = 90;
            } else if (direction == ForgeDirection.EAST) {
                angle = -90;
            }
        }

        GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float adjustedLidAngle = tileEntityLootBox.prevLidAngle
                + (tileEntityLootBox.lidAngle - tileEntityLootBox.prevLidAngle) * tick;
        adjustedLidAngle = 1.0F - adjustedLidAngle;
        adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
        modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);
        modelChest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}