List of usage examples for org.lwjgl.opengl GL11 glColor4f
public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.util.Utils.java
License:Open Source License
/** * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color *//*from ww w .ja v a2 s . co m*/ public static void drawRect(int x1, int y1, int x2, int y2, int color, float zLevel) { int var5; if (x1 < x2) { var5 = x1; x1 = x2; x2 = var5; } if (y1 < y2) { var5 = y1; y1 = y2; y2 = var5; } float var10 = (color >> 24 & 255) / 255.0F; float var6 = (color >> 16 & 255) / 255.0F; float var7 = (color >> 8 & 255) / 255.0F; float var8 = (color & 255) / 255.0F; Tessellator var9 = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(var6, var7, var8, var10); var9.startDrawingQuads(); var9.addVertex(x1, y2, zLevel); var9.addVertex(x2, y2, zLevel); var9.addVertex(x2, y1, zLevel); var9.addVertex(x1, y1, zLevel); var9.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.pahimar.ee3.client.gui.inventory.GuiEnergyCondenser.java
License:LGPL
@Override protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(Textures.GUI_ENERGY_CONDENSER); int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); this.drawTexturedModalRect(xStart + 40, yStart + 5, 0, 195, (int) (Float.parseFloat(tileEnergyCondenser.getCustomName()) / TileEnergyCondenser.maxEMC * 123), 18);/*from w w w .j a v a 2 s . co m*/ this.drawTexturedModalRect(xStart + 40, yStart + 5, 0, 213, 123, 20); }
From source file:com.pahimar.ee3.client.gui.inventory.GuiPortableCrafting.java
License:LGPL
/** * Draw the background layer for the GuiContainer (everything behind the * items)//from w w w.j a v a 2 s . c o m */ @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(Textures.GUI_PORTABLE_CRAFTING); int var5 = (width - xSize) / 2; int var6 = (height - ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize); }
From source file:com.pahimar.ee3.client.gui.inventory.GuiPortableTransmutation.java
License:LGPL
@Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(Textures.GUI_PORTABLE_TRANSMUTATION); int var5 = (width - xSize) / 2; int var6 = (height - ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize); }
From source file:com.pahimar.ee3.client.renderer.RenderUtils.java
License:LGPL
public static void renderRotatingBlockIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack stack, int x, int y, float zLevel, float scale) { RenderBlocks renderBlocks = new RenderBlocks(); Block block = Block.blocksList[stack.itemID]; renderEngine.bindTexture(Textures.VANILLA_BLOCK_TEXTURE_SHEET); GL11.glPushMatrix();/*from w w w.j a v a 2 s . c om*/ GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); GL11.glTranslatef(1.0F, 0.5F, 1.0F); GL11.glScalef(1.0F * scale, 1.0F * scale, -1.0F); GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(0F + 1 * rotationAngle, 0.0F, 1.0F, 0.0F); rotationAngle = (rotationAngle + 1) % 360; int var10 = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0); float var16 = (var10 >> 16 & 255) / 255.0F; float var12 = (var10 >> 8 & 255) / 255.0F; float var13 = (var10 & 255) / 255.0F; GL11.glColor4f(var16, var12, var13, 1.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); renderBlocks.useInventoryTint = true; renderBlocks.renderBlockAsItem(block, stack.getItemDamage(), 1.0F); renderBlocks.useInventoryTint = true; GL11.glPopMatrix(); }
From source file:com.pahimar.ee3.client.renderer.RenderUtils.java
License:LGPL
public static void renderItemIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack itemStack, int x, int y, float opacity, float scale) { Icon icon = itemStack.getIconIndex(); GL11.glDisable(GL11.GL_LIGHTING);/*w w w .j a v a 2 s . c o m*/ renderEngine.bindTexture(Textures.VANILLA_ITEM_TEXTURE_SHEET); int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0); float red = (overlayColour >> 16 & 255) / 255.0F; float green = (overlayColour >> 8 & 255) / 255.0F; float blue = (overlayColour & 255) / 255.0F; GL11.glColor4f(red, green, blue, opacity); drawTexturedQuad(x, y, icon, 16 * scale, 16 * scale, -90); GL11.glEnable(GL11.GL_LIGHTING); }
From source file:com.pahimar.ee3.client.renderer.tileentity.TileEntityAlchemicalChestRenderer.java
License:LGPL
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { if (tileEntity instanceof TileAlchemicalChest) { TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) tileEntity; ForgeDirection direction = null; if (tileAlchemicalChest.getWorldObj() != null) { direction = ForgeDirection.getOrientation(tileAlchemicalChest.getBlockMetadata()); }/*from w w w . j a v a 2s . c o m*/ FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST); 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 = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.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); } }
From source file:com.pahimar.ee3.client.renderer.tileentity.TileEntityEnergyCondenserRenderer.java
License:LGPL
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { if (tileEntity instanceof TileEnergyCondenser) { TileEnergyCondenser tileEnergyCondenser = (TileEnergyCondenser) tileEntity; ForgeDirection direction = null; if (tileEnergyCondenser.getWorldObj() != null) { direction = ForgeDirection.getOrientation(tileEnergyCondenser.getBlockMetadata()); }//from w ww. j a v a 2 s . c om FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ENERGY_CONDENSER); 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 = tileEnergyCondenser.prevLidAngle + (tileEnergyCondenser.lidAngle - tileEnergyCondenser.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); } }
From source file:com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler.java
License:LGPL
public static void renderPulsingQuad(int texture, float maxTransparency) { float pulseTransparency = getPulseValue() * maxTransparency / 3000f; GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_BLEND);/*from ww w.j a v a 2s.c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, pulseTransparency); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(1, 1, 1, pulseTransparency); tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, 1); tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 1, 1); tessellator.addVertexWithUV(0.5D, -0.5D, 0F, 1, 0); tessellator.addVertexWithUV(-0.5D, -0.5D, 0F, 0, 0); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL12.GL_RESCALE_NORMAL); }
From source file:com.professorvennie.machinerycraft.client.gui.book.GuiBook.java
License:Creative Commons License
@Override public void drawScreen(int par1, int par2, float par3) { GL11.glColor4f(1F, 1F, 1F, 1F); mc.renderEngine.bindTexture(texture); drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight); drawCenteredString(fontRendererObj, getTitle(), left + guiWidth / 2, top - getTitleHeight(), 0xFF5A28); String subtitle = getSubtitle(); if (subtitle != null) { GL11.glScalef(0.5F, 0.5F, 1F);//w w w . j ava 2 s . com drawCenteredString(fontRendererObj, subtitle, left * 2 + guiWidth, (top - getTitleHeight() + 10) * 2, 0xFF5A28); GL11.glScalef(2F, 2F, 1F); } drawHeader(); super.drawScreen(par1, par2, par3); }