List of usage examples for org.lwjgl.opengl GL11 glColor3f
public static native void glColor3f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue);
From source file:unit.Unit.java
License:Open Source License
public void draw() { Color playerColour = owner.getColour(); GL11.glColor3f(playerColour.getRed() / 255.0f, playerColour.getGreen() / 255.0f, playerColour.getBlue() / 255.0f); skin.bind();//from www. jav a 2s.com GL11.glPushMatrix(); GL11.glTranslatef(pos.x, pos.y, pos.z); GL11.glRotatef(dir * GameMath.DEGREES_PER_RADIAN, 0, 0, 1); // shell.draw(); model.draw(state); GL11.glPopMatrix(); }
From source file:v3XzZ.mFC.client.render.tileentity.TileEntityBarrelRender.java
License:LGPL
private void renderBeerKeg(TileEntityBarrel tileentity, float i, float j, float k, float var8) { int var9 = 0; if (tileentity.hasWorldObj()) { var9 = tileentity.getBlockMetadata(); }// w w w . j av a 2 s. co m /** =========================All_Main_Objects============================= */ this.func_110628_a(Textures.MODEL_BARREL); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(i + 0.5F, j + 1.5F, k + 0.5F); GL11.glScalef(1.0F, -1.0F, -1.0F); short var10 = 0; if (var9 == 2) { var10 = 180; } if (var9 == 4) { var10 = 0; } if (var9 == 5) { var10 = 90; } if (var9 == 3) { var10 = -90; } GL11.glRotatef((float) var10, 0.0F, 1.0F, 0.0F); this.model.renderAll(); if (tileentity.isOpen) { if (tileentity.content[0] != null) { GL11.glPushMatrix(); this.setColorOpaque_I(ColorCode.getColor(tileentity.content[0], ApiCommon.barrelColor)); GL11.glTranslatef(0F, (float) -(tileentity.content[0].stackSize / (float) (tileentity.getInventoryStackLimit() * 2)), 0F); this.model.renderContent(); GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); } GL11.glTranslatef(-0.17F, 1.5F, 0.0F); GL11.glRotatef(-110F, 0F, 0F, 1F); } this.model.renderTop(); GL11.glPopMatrix(); }
From source file:v3XzZ.mFC.client.render.tileentity.TileEntityBarrelRender.java
License:LGPL
/** * Sets the color to the given opaque value (stored as byte values packed in an integer). *//*from w w w .j a va 2 s.co m*/ private void setColorOpaque_I(int par1) { int j = par1 >> 16 & 255; int k = par1 >> 8 & 255; int l = par1 & 255; GL11.glColor3f((float) j / 255, (float) k / 255, (float) l / 255); }
From source file:vazkii.botania.client.core.handler.TiaraWingRenderHandler.java
License:Creative Commons License
@SubscribeEvent public void onPlayerRender(RenderPlayerEvent.Specials.Post event) { InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.entityPlayer); if (inv.getStackInSlot(0) != null && inv.getStackInSlot(0).getItem() instanceof ItemFlightTiara) { int meta = inv.getStackInSlot(0).getItemDamage(); if (meta > 0 && meta <= ItemFlightTiara.wingIcons.length) { IIcon icon = ItemFlightTiara.wingIcons[meta - 1]; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); boolean flying = event.entityPlayer.capabilities.isFlying; float rz = 120F; float rx = 20F + (float) ((Math.sin((double) event.entityPlayer.ticksExisted * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F)); float ry = 0F; float h = 0.2F; float i = 0.15F; float s = 1F; GL11.glPushMatrix();//from ww w . j a va 2 s.co m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); switch (meta) { case 1: { // Jibril h = 0.4F; break; } case 2: { // Sephiroth s = 1.3F; break; } case 3: { // Cirno h = -0.1F; rz = 0F; rx = 0F; i = 0.3F; break; } case 4: { // Fire int light = 15728880; int lightmapX = light % 65536; int lightmapY = light / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); break; } case 5: { // Kuroyukihime h = 0.8F; rz = 180F; ry = -rx; rx = 0F; s = 2F; break; } case 6: { // Random Devil rz = 150F; break; } case 7: { // Lyfa h = -0.1F; rz = 0F; ry = -rx; rx = 0F; GL11.glColor4f(1F, 1F, 1F, 0.5F + (float) Math.cos((double) event.entityPlayer.ticksExisted * 0.3F) * 0.2F); break; } } float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float sr = 1F / s; if (event.entityPlayer.isSneaking()) GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0F, h, i); GL11.glRotatef(rz, 0F, 0F, 1F); GL11.glRotatef(rx, 1F, 0F, 0F); GL11.glRotatef(ry, 0F, 1F, 0F); GL11.glScalef(s, s, s); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glScalef(sr, sr, sr); GL11.glRotatef(-ry, 0F, 1F, 0F); GL11.glRotatef(-rx, 1F, 0F, 0F); GL11.glRotatef(-rz, 0F, 0F, 1F); if (meta != 2) { // Sephiroth GL11.glScalef(-1F, 1F, 1F); GL11.glRotatef(rz, 0F, 0F, 1F); GL11.glRotatef(rx, 1F, 0F, 0F); GL11.glRotatef(ry, 0F, 1F, 0F); GL11.glScalef(s, s, s); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glScalef(sr, sr, sr); GL11.glRotatef(-ry, 1F, 0F, 0F); GL11.glRotatef(-rx, 1F, 0F, 0F); GL11.glRotatef(-rz, 0F, 0F, 1F); } GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); // Jibril's Halo if (meta == 1) renderHalo(event.entityPlayer, event.partialRenderTick); } } }
From source file:vazkii.botania.client.render.tile.RenderTileBellows.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { TileBellows bellows = (TileBellows) tileentity; GL11.glPushMatrix();/*from www . ja va 2s .co m*/ GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); Minecraft.getMinecraft().renderEngine.bindTexture(texture); int meta = bellows.getWorldObj() != null ? bellows.getBlockMetadata() : 0; GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glScalef(1F, -1F, -1F); GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length, meta - 2), 0)], 0F, 1F, 0F); model.render(Math.max(0.1F, 1F - (bellows.movePos + bellows.moving * f + 0.1F))); GL11.glColor3f(1F, 1F, 1F); GL11.glScalef(1F, -1F, -1F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileBrewery.java
License:Open Source License
public void renderItemStack(ItemStack stack) { if (stack != null) { Minecraft mc = Minecraft.getMinecraft(); mc.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); float s = 0.25F; GL11.glScalef(s, s, s);// www .j a va 2 s .c o m GL11.glScalef(2F, 2F, 2F); if (!ForgeHooksClient.renderEntityItem( new EntityItem(brewery.getWorldObj(), brewery.xCoord, brewery.yCoord, brewery.zCoord, stack), stack, 0F, 0F, brewery.getWorldObj().rand, mc.renderEngine, RenderBlocks.getInstance(), 1)) { GL11.glScalef(0.5F, 0.5F, 0.5F); if (stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) { GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(1F, 1.1F, 0F); GL11.glPushMatrix(); RenderBlocks.getInstance().renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F); GL11.glPopMatrix(); GL11.glTranslatef(-1F, -1.1F, 0F); GL11.glScalef(2F, 2F, 2F); } else { int renderPass = 0; do { IIcon icon = stack.getItem().getIcon(stack, renderPass); if (icon != null) { Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); } } GL11.glScalef(1F / s, 1F / s, 1F / s); Minecraft.getMinecraft().renderEngine.bindTexture(texture); } }
From source file:vazkii.botania.client.render.tile.RenderTileFloatingFlower.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double d0, double d1, double d2, float t) { IFloatingFlower flower = (IFloatingFlower) tile; GL11.glPushMatrix();//from w w w .j a v a 2 s.c o m GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); double worldTime = tile.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + t); if (tile.getWorldObj() != null) worldTime += new Random(tile.xCoord ^ tile.yCoord ^ tile.zCoord).nextInt(1000); GL11.glTranslatef(0.5F, 0F, 0.5F); GL11.glRotatef(-((float) worldTime * 0.5F), 0F, 1F, 0F); GL11.glTranslatef(-0.5F, 0F, -0.5F); if (tile.getWorldObj() != null) { GL11.glTranslatef(0F, (float) Math.sin(worldTime * 0.05F) * 0.1F, 0F); GL11.glRotatef(4F * (float) Math.sin(worldTime * 0.04F), 1F, 0F, 0F); } Minecraft.getMinecraft().renderEngine.bindTexture(flower.getIslandType().getResource()); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 1.4F, 0.5F); GL11.glScalef(1F, -1F, -1F); model.render(); GL11.glPopMatrix(); ItemStack stack = flower.getDisplayStack(); IIcon icon = stack.getIconIndex(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); GL11.glTranslatef(0.25F, 0.4F, 0.5F); GL11.glScalef(0.5F, 0.5F, 0.5F); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileIncensePlate.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) { TileIncensePlate plate = (TileIncensePlate) tileentity; int meta = plate.getWorldObj() != null ? plate.getBlockMetadata() : 0; GL11.glPushMatrix();//from w w w .j a v a 2 s . c o m GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glScalef(1F, -1F, -1F); GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length, meta - 2), 0)], 0F, 1F, 0F); model.render(); GL11.glScalef(1F, -1F, -1F); ItemStack stack = plate.getStackInSlot(0); if (stack != null) { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); float s = 0.4F; GL11.glTranslatef(0.1F, -1.46F, 0F); GL11.glScalef(s, s, s); GL11.glRotatef(180F, 0F, 1F, 0F); int renderPass = 0; do { IIcon icon = stack.getItem().getIcon(stack, renderPass); if (icon != null) { Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); GL11.glPopMatrix(); } GL11.glColor3f(1F, 1F, 1F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileMiniIsland.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tile, double d0, double d1, double d2, float t) { GL11.glPushMatrix();//from w ww . ja va 2 s. co m GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); int worldTime = tile.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame; if (tile.getWorldObj() != null) worldTime += new Random(tile.xCoord ^ tile.yCoord ^ tile.zCoord).nextInt(1000); GL11.glTranslatef(0.5F, 0F, 0.5F); GL11.glRotatef(-(worldTime * 0.5F), 0F, 1F, 0F); GL11.glTranslatef(-0.5F, 0F, -0.5F); if (tile.getWorldObj() != null) { GL11.glTranslatef(0F, (float) Math.sin((double) worldTime * 0.05F) * 0.1F, 0F); GL11.glRotatef(4F * (float) Math.sin((double) worldTime * 0.04F), 1F, 0F, 0F); } Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 1.4F, 0.5F); GL11.glScalef(1F, -1F, -1F); model.render(); GL11.glPopMatrix(); int meta = tile.getWorldObj() == null ? forcedMetadata : tile.getBlockMetadata(); IIcon icon = BlockModFlower.icons[meta]; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); GL11.glTranslatef(0.25F, 0.4F, 0.5F); GL11.glScalef(0.5F, 0.5F, 0.5F); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTilePump.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { TilePump pump = (TilePump) tileentity; GL11.glPushMatrix();//from www . j a v a 2s. co m GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); Minecraft.getMinecraft().renderEngine.bindTexture(texture); int meta = pump.getWorldObj() != null ? pump.getBlockMetadata() : 0; GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glScalef(1F, -1F, -1F); GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length, meta - 2), 0)], 0F, 1F, 0F); model.render(Math.max(0F, Math.min(8F, pump.innerRingPos + pump.moving * f))); GL11.glColor3f(1F, 1F, 1F); GL11.glScalef(1F, -1F, -1F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }