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.eagle.resonantreflux.gui.GuiFluxCrystallizationChamber.java

License:Open Source License

private void drawGuiPowerBar() {
    int x2 = (width - xSize) / 2;
    int y2 = (height - ySize) / 2;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(Dictionary.GUI_CRYSTALCHAMBER);
    int powerStored = tileEntity.getPowerStored();
    int maxPowerStored = tileEntity.getMaxPowerStored();
    float powerPercentage = (float) powerStored / maxPowerStored;
    float barHeight = powerPercentage * 40;
    drawTexturedModalRect(10, 63 - Math.round(barHeight), 176, 16, 12, Math.round(barHeight));

    if (mouseX > 8 + x2 && mouseX < 23 + x2) {
        if (mouseY > 21 + y2 && mouseY < 64 + y2) {
            List list = new ArrayList();
            list.add(tileEntity.getPowerStored() + " / " + tileEntity.getMaxPowerStored() + " RF");
            this.drawHoveringText(list, (int) mouseX - x2, (int) mouseY - y2, fontRendererObj);
        }// w w  w  . jav  a 2 s  . c  o m
    }
}

From source file:com.enderville.mod.client.gui.GUIEnderCoinBank.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.getTextureManager().bindTexture(field_110421_t);
    int x = (this.width - this.xSize) / 2;
    int y = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
}

From source file:com.enderville.mod.client.gui.mainmenu.GuiLinks.java

License:LGPL

@Override
public void drawBackground(int par1) {
    GL11.glDisable(GL11.GL_LIGHTING);/*from   w w w.  j a va 2  s . c o  m*/
    GL11.glDisable(GL11.GL_FOG);
    Tessellator tessellator = Tessellator.instance;
    this.mc.getTextureManager().bindTexture(optionsBackground);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float f = 32.0F;
    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_I(4210752);
    tessellator.addVertexWithUV(0.0D, (double) this.height, 0.0D, 0.0D,
            (double) ((float) this.height / f + (float) par1));
    tessellator.addVertexWithUV((double) this.width, (double) this.height, 0.0D,
            (double) ((float) this.width / f), (double) ((float) this.height / f + (float) par1));
    tessellator.addVertexWithUV((double) this.width, 0.0D, 0.0D, (double) ((float) this.width / f),
            (double) par1);
    tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double) par1);
    tessellator.draw();
}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

private void drawPanorama(int par1, int par2, float par3) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();//from   ww w. j  a v  a 2s  .co  m
    GL11.glLoadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GL11.glPushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GL11.glTranslatef(f1, f2, f3);
        GL11.glRotatef(MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F,
                0.0F);
        GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();

            if (l == 1) {
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 2) {
                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 3) {
                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 4) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if (l == 5) {
                GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + f4), (double) (0.0F + f4));
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - f4), (double) (0.0F + f4));
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - f4), (double) (1.0F - f4));
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + f4), (double) (1.0F - f4));
            tessellator.draw();
            GL11.glPopMatrix();
        }

        GL11.glPopMatrix();
        GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

/**
 * Draws the screen and all the components in it.
 *///from  w w w. j  av a  2 s .  c  o m
public void drawScreen(int par1, int par2, float par3) {
    this.renderSkybox(par1, par2, par3);
    Tessellator tessellator = Tessellator.instance;
    short short1 = 274;
    int k = this.width / 2 - short1 / 2;
    byte b0 = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double) this.updateCounter < 1.0E-4D) {
        this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
        this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
        this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
        this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44);
        this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
    } else {
        this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44);
        this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
    }

    tessellator.setColorOpaque_I(16777215);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
    GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
    float f1 = 1.8F - MathHelper
            .abs(MathHelper.sin((float) (Minecraft.getSystemTime() % 1000L) / 1000.0F * (float) Math.PI * 2.0F)
                    * 0.1F);
    f1 = f1 * 100.0F / (float) (this.fontRenderer.getStringWidth(this.splashText) + 32);
    GL11.glScalef(f1, f1, f1);
    this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 0x8A0868);
    GL11.glPopMatrix();
    String s = "Minecraft 1.6.4";
    this.drawString(this.fontRenderer, s, 2, this.height - (10 + 0 * (this.fontRenderer.FONT_HEIGHT + 1)),
            Color.YELLOW.getRGB());

    if (this.mc.isDemo()) {
        s = s + " Demo";
    }

    String s1 = this.getVersion();
    drawString(this.fontRenderer, s1, this.width - this.fontRenderer.getStringWidth(s1) - 2, this.height - 10,
            0x8A0868);

    if ((this.field_92025_p != null) && (this.field_92025_p.length() > 0)) {
        drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1,
                1428160512);
        drawString(this.fontRenderer, this.field_92025_p, this.field_92022_t, this.field_92021_u, 16777215);
    }

    super.drawScreen(par1, par2, par3);
}

From source file:com.endreman0.souleater.client.gui.GuiInfoBook.java

License:Creative Commons License

@Override
public void drawScreen(int mouseX, int mouseY, float f) {
    drawDefaultBackground();//Dark filter over world, like in inventory and options

    GL11.glPushMatrix();//This starts GL drawing.
    mc.renderEngine.bindTexture(texture);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glScaled(scale, scale, scale);//from w  w w  .  java  2s.co m
    drawTexturedModalRect((int) ((width / 2 - (128 * scale)) * 2 / 3), (int) (height / 2 - (67 * scale)), 0, 0,
            256, 135);
    GL11.glPopMatrix();//Pushing and popping prevents you having to undo all of the translates, rotates and scales

    String[] thisPage = text[2 * page];
    for (int i = 0; i < thisPage.length; i++) {
        fontRendererObj.drawString(thisPage[i],
                x1 + guiWidth / 4 - fontRendererObj.getStringWidth(thisPage[i]) / 2,
                (int) (height * 0.23 + fontRendererObj.FONT_HEIGHT * i), 0x000000, false);
    }
    if (2 * page < lengthPages - 1) {
        thisPage = text[2 * page + 1];
        for (int i = 0; i < thisPage.length; i++) {
            fontRendererObj.drawString(thisPage[i],
                    x1 + guiWidth * 3 / 4 - fontRendererObj.getStringWidth(thisPage[i]) / 2,
                    (int) (height * 0.23 + fontRendererObj.FONT_HEIGHT * i), 0x000000, false);
        }
    }

    super.drawScreen(mouseX, mouseY, f);//Draws buttons and labels
}

From source file:com.ethylamine.fsynthesis.client.gui.GeminiMachineGUI.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float mouseX, int mouseZ, int renderPartialTicks) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    mc.getTextureManager().bindTexture(TEXTURE);

    final int xStart = (width - xSize) / 2;
    final int yStart = (height - ySize) / 2;
    drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}

From source file:com.fatality.skillcraft.api.utils.GuiSliderButton.java

License:Open Source License

public void drawButton(Minecraft mc, int i, int j) {

    if (this.visible) {

        boolean flag = Mouse.isButtonDown(0);
        int k1 = this.xPosition;
        int k2 = k1 + this.width;

        int l1 = this.yPosition;
        int l2 = l1 + (int) maxValue;
        if (flag && i >= k1 && j >= l1 && i < k2 && j < l2) {
            this.isScrolling = true;
        }//from w ww .j a v  a 2  s. com

        if (!flag) {
            this.isScrolling = false;
        }

        int scrollING = 0;
        if (isScrolling) {
            scrollING = this.width;
        }

        this.wasClicking = flag;

        mc.getTextureManager().bindTexture(texture);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        this.drawTexturedModalRect(this.xPosition, this.yPosition + (int) sliderValue, textureX + scrollING,
                textureY, this.width, this.height);
        this.mouseDragged(mc, i, j);
    }
}

From source file:com.fireball1725.firecore.client.gui.GuiBase.java

License:Open Source License

public void drawTooltip(int mouseX, int mouseY, int forceWidth, String message) {
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    int[][] savedGLState = OpenGLHelper.saveGLState(new int[] { GL11.GL_ALPHA_TEST, GL11.GL_LIGHTING });

    GL11.glPushMatrix();//from w  w  w.ja v  a 2s.c o  m

    guiHelper.drawWindowWithBorder(mouseX, mouseY, forceWidth, 10, colorBackground, colorBorder);
    guiHelper.drawCenteredStringWithShadow(mouseX, mouseY, forceWidth, "Hello World", colorFont);

    GL11.glPopMatrix();

    OpenGLHelper.restoreGLState(savedGLState);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}

From source file:com.fireball1725.firecore.client.gui.GuiBase.java

License:Open Source License

protected final void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    int ox = this.guiLeft;
    int oy = this.guiTop;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    drawBG(ox, oy, x, y);//w ww.  j a va  2 s  .  com
}