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:appeng.parts.reporting.PartStorageMonitor.java

License:Open Source License

private void tesrRenderScreen(Tessellator tess, IAEItemStack ais) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    ForgeDirection d = this.side;
    GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);

    if (d == ForgeDirection.UP) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.spin * 90.0F, 0, 0, 1);
    }/*from  ww w . j  av  a 2s.  c o  m*/

    if (d == ForgeDirection.DOWN) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.spin * -90.0F, 0, 0, 1);
    }

    if (d == ForgeDirection.EAST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (d == ForgeDirection.WEST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (d == ForgeDirection.NORTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
    }

    if (d == ForgeDirection.SOUTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    }

    GL11.glPushMatrix();
    try {
        ItemStack sis = ais.getItemStack();
        sis.stackSize = 1;

        int br = 16 << 20 | 16 << 4;
        int var11 = br % 65536;
        int var12 = br / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        // RenderHelper.enableGUIStandardItemLighting();
        tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

        ClientHelper.proxy.doRenderItem(sis, this.tile.getWorldObj());
    } catch (Exception e) {
        AELog.error(e);
    }

    GL11.glPopMatrix();

    GL11.glTranslatef(0.0f, 0.14f, -0.24f);
    GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f);

    final long stackSize = ais.getStackSize();
    final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize);

    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    int width = fr.getStringWidth(renderedStackSize);
    GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
    fr.drawString(renderedStackSize, 0, 0, 0);

    GL11.glPopAttrib();
}

From source file:arekkuusu.grimoireOfAlice.client.gui.GuiScreenYoukaiBook.java

License:Open Source License

@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.getTextureManager().bindTexture(BOOK_GUI_TEXTURES);
    int k = (width - BOOK_IMAGE_WIDTH) / 2;
    byte b0 = 2;/*  w  w w.  j  a  va2  s.c  om*/
    drawTexturedModalRect(k, b0, 0, 0, BOOK_IMAGE_WIDTH, BOOK_IMAGE_HEIGHT);
    String s;
    String s1 = "Secret spell for Grimoire";
    int l;

    if (field_146480_s) {
        s = bookTitle;

        if (bookIsUnsigned) {
            if (updateCount / 6 % 2 == 0) {
                s = s + "" + EnumChatFormatting.DARK_PURPLE + "_";
            } else {
                s = s + "" + EnumChatFormatting.DARK_PURPLE + "_";
            }
        }
        l = fontRendererObj.getStringWidth(s1);
        fontRendererObj.drawString(s1, k + 36 + (116 - l) / 2, b0 + 16 + 16, 0);
        int i1 = fontRendererObj.getStringWidth(s);
        fontRendererObj.drawString(s, k + 36 + (116 - i1) / 2, b0 + 48, 0);
        String s2 = I18n.format("Grimoire of " + editingPlayer.getCommandSenderName());
        int j1 = fontRendererObj.getStringWidth(s2);
        fontRendererObj.drawString(EnumChatFormatting.DARK_RED + s2, k + 36 + (116 - j1) / 2, b0 + 48 + 10, 0);
        String s3 = I18n.format("This book must be sealed to prevent someone else from reading the scriptures");
        fontRendererObj.drawSplitString(s3, k + 36, b0 + 80, 116, 0);
    } else {
        s = I18n.format("book.pageIndicator", currPage + 1, bookTotalPages);
        s1 = "";

        if (bookPages != null && currPage >= 0 && currPage < bookPages.tagCount()) {
            s1 = bookPages.getStringTagAt(currPage);
        }

        if (bookIsUnsigned) {
            if (fontRendererObj.getBidiFlag()) {
                s1 = s1 + "_";
            } else if (updateCount / 6 % 2 == 0) {
                s1 = s1 + "" + EnumChatFormatting.DARK_PURPLE + "_";
            } else {
                s1 = s1 + "" + EnumChatFormatting.DARK_PURPLE + "_";
            }
        }

        l = fontRendererObj.getStringWidth(s);
        fontRendererObj.drawString(s, k - l + BOOK_IMAGE_WIDTH - 44, b0 + 16, 0);
        fontRendererObj.drawSplitString(s1, k + 36, b0 + 16 + 16, 116, 0);
    }

    super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}

From source file:arg.RenderRecipe.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 */// ww w  . j ava2s  . c om
@Override
public void drawScreen(int par1, int par2, float par3) {
    this.drawDefaultBackground();
    int k = this.guiLeft;
    int l = this.guiTop;
    this.drawGuiContainerBackgroundLayer(par3, par1, par2);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glPushMatrix();
    GL11.glTranslatef((float) k, (float) l, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    short short1 = 240;
    short short2 = 240;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) short1 / 1.0F,
            (float) short2 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int i1;

    // crafting result
    drawSlotInventory((Slot) inventorySlots.inventorySlots.get(0));

    incredientList.clear();

    for (int j1 = 1; j1 < inventorySlots.inventorySlots.size(); ++j1) {
        Slot slot = (Slot) inventorySlots.inventorySlots.get(j1);
        drawSlotInventory(slot);
    }

    this.drawGuiContainerForegroundLayer(par1, par2);

    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    RenderHelper.enableStandardItemLighting();
}

From source file:arg.RenderRecipe.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);//from   ww w. j a  va 2s. com
    this.mc.renderEngine.bindTexture(new ResourceLocation("arg", "textures/gui/crafting.png"));
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);
    // GL11.glDisable(GL11.GL_TEXTURE_2D);
}

From source file:aritzh.afm.client.gui.AFMGUI.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(final float var1, final int var2, final int var3) {

    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    this.mc.renderEngine.func_110577_a(this.backgroundTexture);
    final int x = (this.width - this.xSize) / 2;
    final int y = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
}

From source file:aroma1997.betterchests.client.BChestRenderer.java

License:Open Source License

public void renderTileEntityChestAt(TileEntityBChest par1TileEntityChest, double par2, double par4, double par6,
        float par8) {
    int i;//from   w ww.j ava 2 s .  c  o  m

    if (!par1TileEntityChest.hasWorldObj()) {
        i = 0;
    } else {
        Block block = par1TileEntityChest.getBlockType();
        i = par1TileEntityChest.getBlockMetadata();

        if (block instanceof BlockChest && i == 0) {
            i = par1TileEntityChest.getBlockMetadata();
        }
    }
    ModelChest modelchest = chestModel;
    bindTexture(model);

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    short short1 = 0;

    if (i == 2) {
        short1 = 180;
    }

    if (i == 3) {
        short1 = 0;
    }

    if (i == 4) {
        short1 = 90;
    }

    if (i == 5) {
        short1 = -90;
    }

    GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    float f1 = par1TileEntityChest.prevLidAngle
            + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8;

    f1 = 1.0F - f1;
    f1 = 1.0F - f1 * f1 * f1;
    modelchest.chestLid.rotateAngleX = -(f1 * (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);
}

From source file:aroma1997.betterchests.upgrades.Blocking.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)//w  ww .j a  v  a 2s .c om
public void draw(GuiContainer gui, ContainerBasic container, int par1, int par2, ItemStack item) {
    int blocked = item.stackSize * 9;
    GL11.glPushMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
    GL11.glEnable(GL11.GL_BLEND);
    for (int i = 0; i < blocked; i++) {
        Slot slot = container.getSlot(i + 36);
        RenderHelper.renderTex(gui, Tex.REDCROSS, slot.xDisplayPosition - 1, slot.yDisplayPosition - 1);
    }
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:aroma1997.compactwindmills.ClientGUIWindmill.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(new ResourceLocation(Reference.ModID + ":textures/gui/GUIWindmill.png"));
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
}

From source file:blfngl.fallout.item.GuiPipboy.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("/blfngl/fallout/textures/GuiPipboy.png");
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;
    this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}

From source file:boilerplate.client.fx.FXRaygun.java

License:Minecraft Mod Public

@Override
public void renderParticle(final Tessellator tessellator, final float f, final float f1, final float f2,
        final float f3, final float f4, final float f5) {
    tessellator.draw();/*from www  . jav a  2s. co m*/
    GL11.glPushMatrix();
    final float var9 = 1.0F;
    final float slide = this.worldObj.getWorldTime();
    final float rot = ((this.worldObj.provider.getWorldTime() % (360 / this.rotationspeed))
            * this.rotationspeed) + (this.rotationspeed * f);
    float size = 0.5F;

    if (this.pulse) {
        size = Math.min(this.particleAge / 4.0F, 1.0F);
        size = this.prevSize + ((size - this.prevSize) * f);
    }

    float op = 0.4F;

    if ((this.pulse) && ((this.particleMaxAge - this.particleAge) <= 4)) {
        op = 0.4F - ((4 - (this.particleMaxAge - this.particleAge)) * 0.1F);
    }

    switch (this.type) {
    default:
        // In case I make another type of beam, I can change the beam
        // texture here
        break;
    case 1:
        // and here...
        break;
    case 2:
        ClientHelper.textureManager().bindTexture(rayTex);
    }

    GL11.glTexParameterf(3553, 10242, 10497.0F);
    GL11.glTexParameterf(3553, 10243, 10497.0F);
    GL11.glDisable(2884);
    float var11 = slide + f;

    if (this.reverse) {
        var11 *= -1.0F; // why name your variables "var11"? That is so
        // un-helpful
    }

    final float var12 = (-var11 * 0.2F) - MathHelper.floor_float(-var11 * 0.1F);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 1);
    GL11.glDepthMask(false);
    double prex = this.player.prevPosX;
    double prey = this.player.prevPosY + this.offset;
    double prez = this.player.prevPosZ;
    double px = this.player.posX;
    double py = this.player.posY + this.offset;
    double pz = this.player.posZ;
    prex -= MathHelper.cos((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.066F;
    prey -= 0.06D;
    prez -= MathHelper.sin((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.04F;
    Vec3 vec3d = this.player.getLook(1.0F);
    prex += vec3d.xCoord * 0.3D;
    prey += vec3d.yCoord * 0.3D;
    prez += vec3d.zCoord * 0.3D;
    px -= MathHelper.cos((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.066F;
    py -= 0.06D;
    pz -= MathHelper.sin((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.04F;
    vec3d = this.player.getLook(1.0F);
    px += vec3d.xCoord * 0.3D;
    py += vec3d.yCoord * 0.3D;
    pz += vec3d.zCoord * 0.3D;
    final float xx = (float) ((prex + ((px - prex) * f)) - EntityFX.interpPosX);
    final float yy = (float) ((prey + ((py - prey) * f)) - EntityFX.interpPosY);
    final float zz = (float) ((prez + ((pz - prez) * f)) - EntityFX.interpPosZ);
    GL11.glTranslated(xx, yy, zz);
    final float ry = this.prevYaw + ((this.rotYaw - this.prevYaw) * f);
    final float rp = this.prevPitch + ((this.rotPitch - this.prevPitch) * f);
    GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(180.0F + ry, 0.0F, 0.0F, -1.0F);
    GL11.glRotatef(rp, 1.0F, 0.0F, 0.0F);
    final double var44 = -0.15D * size;
    final double var17 = 0.15D * size;
    final double var44b = -0.15D * size * this.endMod;
    final double var17b = 0.15D * size * this.endMod;
    GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);

    for (int t = 0; t < 5; t++) {
        final double var29 = this.length * size * var9;
        final double var31 = 0.0D;
        final double var33 = 1.0D;
        final double var35 = -1.0F + var12 + (t / 3.0F);
        final double var37 = (this.length * size * var9) + var35;
        GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.setBrightness(200);
        tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, op);
        tessellator.addVertexWithUV(var44b, var29, 0.0D, var33, var37);
        tessellator.addVertexWithUV(var44, 0.0D, 0.0D, var33, var35);
        tessellator.addVertexWithUV(var17, 0.0D, 0.0D, var31, var35);
        tessellator.addVertexWithUV(var17b, var29, 0.0D, var31, var37);
        tessellator.draw();
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDepthMask(true);
    GL11.glDisable(3042);
    GL11.glEnable(2884);
    GL11.glPopMatrix();
    tessellator.startDrawingQuads();
    this.prevSize = size;
}