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:chb.mods.mffs.client.GuiProjector.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    int textur = mc.renderEngine.getTexture("/chb/mods/mffs/sprites/GuiProjector.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(textur);

    int w = (width - xSize) / 2;
    int k = (height - ySize) / 2;

    drawTexturedModalRect(w, k, 0, 0, xSize, ySize);
    int i1 = (79 * projector.getCapacity() / 100);
    drawTexturedModalRect(w + 8, k + 71, 176, 0, i1 + 1, 79);

    if (projector.getProjektor_Typ() != 0) {
        if (projector.getProjektor_Typ() != 7) {
            drawTexturedModalRect(w + 119, k + 43, 177, 143, 16, 16);
        }/*from   ww  w .  j a  va2  s.co  m*/

        if (projector.getProjektor_Typ() != 4 && projector.getProjektor_Typ() != 2) {
            drawTexturedModalRect(w + 155, k + 43, 177, 143, 16, 16);
        }

        if (projector.getProjektor_Typ() == 1 || projector.getProjektor_Typ() == 2
                || projector.getProjektor_Typ() == 6 || projector.getProjektor_Typ() == 7) {
            drawTexturedModalRect(w + 137, k + 8, 177, 143, 16, 16);

            drawTexturedModalRect(w + 137, k + 42, 177, 143, 16, 16);

            drawTexturedModalRect(w + 154, k + 25, 177, 143, 16, 16);

            drawTexturedModalRect(w + 120, k + 25, 177, 143, 16, 16);
        }

        if (projector.isOptioncamouflage()) {
            drawTexturedModalRect(w + 137, k + 25, 177, 143, 16, 16); // center
        }
    }
}

From source file:chb.mods.mffs.client.GuiSecurityStation.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    int textur = mc.renderEngine.getTexture("/chb/mods/mffs/sprites/GuiSecstation.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(textur);
    int w = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(w, k, 0, 0, xSize, ySize);
}

From source file:chb.mods.mffs.client.TECapacitorRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
    if (tileEntity instanceof TileEntityCapacitor) {
        TileEntityCapacitor topview = (TileEntityCapacitor) tileEntity;
        GL11.glPushMatrix();//from w  w  w.  j  av  a2 s  . c  om
        GL11.glPolygonOffset(-10, -10);
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        int side = topview.getSide();
        float dx = 1F / 16;
        float dz = 1F / 16;
        float displayWidth = 1 - 2F / 16;
        float displayHeight = 1 - 2F / 16;
        GL11.glTranslatef((float) x, (float) y, (float) z);
        switch (side) {
        case 1:

            break;
        case 0:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(180, 1, 0, 0);
            GL11.glRotatef(180, 0, 1, 0);

            break;
        case 3:
            GL11.glTranslatef(0, 1, 0);
            GL11.glRotatef(0, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 2:
            GL11.glTranslatef(1, 1, 1);
            GL11.glRotatef(180, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 5:
            GL11.glTranslatef(0, 1, 1);
            GL11.glRotatef(90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 4:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(-90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        }
        GL11.glTranslatef(dx + displayWidth / 2, 1F, dz + displayHeight / 2);
        GL11.glRotatef(-90, 1, 0, 0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        FontRenderer fontRenderer = this.getFontRenderer();
        int maxWidth = 1;
        String header = "MFFS Capacitor";
        maxWidth = Math.max(fontRenderer.getStringWidth(header), maxWidth);
        maxWidth += 4;
        int lineHeight = fontRenderer.FONT_HEIGHT + 2;
        int requiredHeight = lineHeight * 1;
        float scaleX = displayWidth / maxWidth;
        float scaleY = displayHeight / requiredHeight;
        float scale = Math.min(scaleX, scaleY);
        GL11.glScalef(scale, -scale, scale);
        GL11.glDepthMask(false);
        int offsetX;
        int offsetY;
        int realHeight = (int) Math.floor(displayHeight / scale);
        int realWidth = (int) Math.floor(displayWidth / scale);

        if (scaleX < scaleY) {
            offsetX = 2;
            offsetY = (realHeight - requiredHeight) / 2;
        } else {
            offsetX = (realWidth - maxWidth) / 2 + 2;
            offsetY = 0;
        }
        GL11.glDisable(GL11.GL_LIGHTING);
        fontRenderer.drawString(header, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -2 * lineHeight,
                1);
        fontRenderer.drawString("capacity: ", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 0 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getCapacity()).concat(" % "),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getCapacity()).concat(" % ")),
                offsetY - realHeight / 2 - 0 * lineHeight, 1);
        fontRenderer.drawString("range: ", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getTransmitRange()),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getTransmitRange())),
                offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString("linked device: ", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 2 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getLinketProjektor()),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getLinketProjektor())),
                offsetY - realHeight / 2 + 2 * lineHeight, 1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthMask(true);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPopMatrix();
    }
}

From source file:chb.mods.mffs.client.TEExtractorRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
    if (tileEntity instanceof TileEntityExtractor) {
        TileEntityExtractor topview = (TileEntityExtractor) tileEntity;
        GL11.glPushMatrix();/*www  .j av  a 2  s .co m*/
        GL11.glPolygonOffset(-10, -10);
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        int side = topview.getSide();
        float dx = 1F / 16;
        float dz = 1F / 16;
        float displayWidth = 1 - 2F / 16;
        float displayHeight = 1 - 2F / 16;
        GL11.glTranslatef((float) x, (float) y, (float) z);
        switch (side) {
        case 1:

            break;
        case 0:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(180, 1, 0, 0);
            GL11.glRotatef(180, 0, 1, 0);

            break;
        case 3:
            GL11.glTranslatef(0, 1, 0);
            GL11.glRotatef(0, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 2:
            GL11.glTranslatef(1, 1, 1);
            GL11.glRotatef(180, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 5:
            GL11.glTranslatef(0, 1, 1);
            GL11.glRotatef(90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 4:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(-90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        }
        GL11.glTranslatef(dx + displayWidth / 2, 1F, dz + displayHeight / 2);
        GL11.glRotatef(-90, 1, 0, 0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        FontRenderer fontRenderer = this.getFontRenderer();
        int maxWidth = 1;
        String header = "MFFS Extractor";
        maxWidth = Math.max(fontRenderer.getStringWidth(header), maxWidth);
        maxWidth += 4;
        int lineHeight = fontRenderer.FONT_HEIGHT + 2;
        int requiredHeight = lineHeight * 1;
        float scaleX = displayWidth / maxWidth;
        float scaleY = displayHeight / requiredHeight;
        float scale = Math.min(scaleX, scaleY);
        GL11.glScalef(scale, -scale, scale);
        GL11.glDepthMask(false);
        int offsetX;
        int offsetY;
        int realHeight = (int) Math.floor(displayHeight / scale);
        int realWidth = (int) Math.floor(displayWidth / scale);

        if (scaleX < scaleY) {
            offsetX = 2;
            offsetY = (realHeight - requiredHeight) / 2;
        } else {
            offsetX = (realWidth - maxWidth) / 2 + 2;
            offsetY = 0;
        }
        GL11.glDisable(GL11.GL_LIGHTING);
        fontRenderer.drawString(header, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -2 * lineHeight,
                1);
        fontRenderer.drawString("WE:", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -0 * lineHeight,
                1);
        fontRenderer.drawString(String.valueOf(topview.getWorkdone()).concat(" % "),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getWorkdone()).concat(" % ")),
                offsetY - realHeight / 2 - 0 * lineHeight, 1);
        fontRenderer.drawString("WC left:", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getWorkCylce()),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getWorkCylce())),
                offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString("FE Cap:", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 2 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getForceEnergybuffer() / 1000).concat("k"),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(
                                String.valueOf(topview.getForceEnergybuffer() / 1000).concat("k")),
                offsetY - realHeight / 2 + 2 * lineHeight, 1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthMask(true);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPopMatrix();
    }
}

From source file:chemistry.electrolysm.gui.gui.GuiMassSpec.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float v, int i, int i2) {
    ySize = 166 + 20;/* www .  ja va 2  s.c  o m*/
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(CommonProxy.GUI_MASS_SPEC);
    int x = (this.width - this.xSize) / 2;
    int y = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);

    //Draw progress bar
    int progress = (entity.timer * 114) / entity.maxTime;
    if (progress > 0) {
        this.drawTexturedModalRect(x + 56, y + 9, 5, 227, progress, 16);
    }
}

From source file:chessMod.client.ChessModDrawBlockHighlightHandler.java

License:LGPL

public static void drawQuad(float x, float y, float width, float height, double zLevel) {

    GL11.glDisable(GL11.GL_LIGHTING);/*w w w  .j av  a2 s  . c om*/
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(5.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0F, 1F, 0F, pulseTransparency);

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertex(x + 0F, y + height, zLevel);
    tessellator.addVertex(x + width, y + height, zLevel);
    tessellator.addVertex(x + width, y + 0F, zLevel);
    tessellator.addVertex(x + 0F, y + 0F, zLevel);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
}

From source file:cn.academy.ability.client.ui.BackgroundMask.java

License:GNU General Public License

@Override
public void draw(ScaledResolution sr) {
    long time = GameTimer.getTime();

    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    AbilityData aData = AbilityData.get(player);
    CPData cpData = CPData.get(player);/*from   w  w  w .  j  a  v a2 s .  c o m*/

    double cr, cg, cb, ca;

    Color color = null;
    if (cpData.isOverloaded()) {
        color = CRL_OVERRIDE;
    } else if (cpData.isActivated()) {
        color = aData.getCategory().getColorStyle();
    }

    if (color == null) {
        cr = r;
        cg = g;
        cb = b;
        ca = 0;
    } else {
        cr = color.r;
        cg = color.g;
        cb = color.b;
        ca = color.a;
    }

    if (ca != 0 || a != 0) {
        long dt = lastFrame == 0 ? 0 : time - lastFrame;
        r = balanceTo(r, cr, dt);
        g = balanceTo(g, cg, dt);
        b = balanceTo(b, cb, dt);
        a = balanceTo(a, ca, dt);

        GL11.glColor4d(r, g, b, a);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        RenderUtils.loadTexture(MASK);
        HudUtils.rect(0, 0, sr.getScaledWidth_double(), sr.getScaledHeight_double());
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
    } else {
        r = cr;
        g = cg;
        b = cb;
    }

    lastFrame = time;
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

@Override
public void draw(double mx, double my, boolean mouseHovering) {
    // Background
    GL11.glEnable(GL11.GL_BLEND);//from ww  w.java  2s.  c  o  m
    super.draw(mx, my, mouseHovering);

    //Player
    GL11.glPushMatrix();
    {
        drawPlayer();
    }
    GL11.glPopMatrix();
    GL11.glColor4f(1, 1, 1, 1);

    // Page name
    String pname = dev.getCurPage().getDisplayName();
    RenderUtils.bindColor(dev.DEFAULT_COLOR);
    ACUtils.drawText(pname, 156, 4.5, 8.5, Align.CENTER);

    //Titles
    ACUtils.drawText(ACLangs.holoView(), 147, 20.5, 7.5);

    ACUtils.drawText(ACLangs.ad_UserInfo(), 147.5, 119, 7.5);

    //Misc
    drawUserInfo();
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

private void drawUserInfo() {
    ACUtils.drawText("CP.", 148, 153, 6);
    ACUtils.drawText("PRG.", 148, 167.5, 6);

    AbilityData data = AbilityDataMain.getData(dev.user);
    ResourceLocation logo = null;/* ww w .  j av a2s  .c  o m*/
    if (data.hasAbility()) {
        Category cat = data.getCategory();
        logo = cat.getLogo();
        //Cat and level
        ACUtils.drawText(cat.getDisplayName(), 167.5, 130, 7.5);
        ACUtils.drawText(data.getLevel().getDisplayName(), 167.5, 140, 5.5);
        //Progress Bar
        RenderUtils.loadTexture(ACClientProps.TEX_GUI_AD_MAIN);
        //CP
        GL11.glColor4f(1, 1, 1, 1);
        double prog = data.getCurrentCP() / data.getMaxCP();
        HudUtils.drawRect(163, 155F, 3, 372, prog * 58.5, 5.5, prog * 117, 11);

        //Update prog
        Level curLv = data.getLevel();
        if (data.getLevelID() < data.getLevelCount() - 1) {
            prog = (data.getMaxCP() - curLv.getInitialCP()) / (curLv.getMaxCP() - curLv.getInitialCP());
        } else {
            prog = 1.0;
        }
        HudUtils.drawRect(163, 168.5F, 3, 387, prog * 58.5, 5.5, prog * 117, 11);
    } else {
        logo = ACClientProps.TEX_QUESTION_MARK;
        ACUtils.drawText(ACLangs.notLearned(), 167.5, 130, 7);
    }
    RenderUtils.loadTexture(logo);
    HudUtils.drawRect(148.5, 130.5, 15.5, 15.5);
}

From source file:cn.academy.core.client.render.SkillRenderDebug.java

License:Open Source License

@SideOnly(Side.CLIENT)
@Override// w  w w.j  av  a 2  s .  c o m
public void renderSurroundings(EntityPlayer player, long time) {
    GL11.glPushMatrix();
    {
        GL11.glTranslated(-.5, 0, -.5);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1, 1, 1, 0.3F);
        RenderUtils.drawCube(1, 1, 2);
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glPopMatrix();
}