List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:minesweeperMod.client.MinesweeperDrawBlockHighlightHandler.java
License:LGPL
public static void drawQuad(float x, float y, float width, float height, double zLevel, int tile) { GL11.glDisable(GL11.GL_TEXTURE_2D);//from w ww. j av a 2s . c o m GL11.glLineWidth(5.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(renderColors.get(tile)[0], renderColors.get(tile)[1], renderColors.get(tile)[2], 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); }
From source file:mods.cloudmaster.CloudRenderer.java
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { if (mc.theWorld.provider.isSurfaceWorld()) { if (mc.gameSettings.fancyGraphics) { renderCloudsFancy(partialTicks, world, mc); } else {// ww w . j a v a 2s . c o m GL11.glDisable(GL11.GL_CULL_FACE); float f1 = (float) (mc.renderViewEntity.lastTickPosY + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * (double) partialTicks); byte b0 = 32; int i = 256 / b0; Tessellator tessellator = Tessellator.instance; mc.renderEngine.bindTexture(CLOUD_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Vec3 vec3 = world.getCloudColour(partialTicks); float f2 = (float) vec3.xCoord; float f3 = (float) vec3.yCoord; float f4 = (float) vec3.zCoord; float f5; if (mc.gameSettings.anaglyph) { f5 = (f2 * 30.0F + f3 * 59.0F + f4 * 11.0F) / 100.0F; float f6 = (f2 * 30.0F + f3 * 70.0F) / 100.0F; float f7 = (f2 * 30.0F + f4 * 70.0F) / 100.0F; f2 = f5; f3 = f6; f4 = f7; } f5 = 4.8828125E-4F; double d0 = (double) ((float) cloudTickCounter + partialTicks); double d1 = mc.renderViewEntity.prevPosX + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * (double) partialTicks + d0 * 0.029999999329447746D; double d2 = mc.renderViewEntity.prevPosZ + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * (double) partialTicks; int j = MathHelper.floor_double(d1 / 2048.0D); int k = MathHelper.floor_double(d2 / 2048.0D); d1 -= (double) (j * 2048); d2 -= (double) (k * 2048); float f8 = getCloudHeight() - f1 + 0.33F; float f9 = (float) (d1 * (double) f5); float f10 = (float) (d2 * (double) f5); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(f2, f3, f4, 0.8F); for (int l = -b0 * i; l < b0 * i; l += b0) { for (int i1 = -b0 * i; i1 < b0 * i; i1 += b0) { tessellator.addVertexWithUV((double) (l + 0), (double) f8, (double) (i1 + b0), (double) ((float) (l + 0) * f5 + f9), (double) ((float) (i1 + b0) * f5 + f10)); tessellator.addVertexWithUV((double) (l + b0), (double) f8, (double) (i1 + b0), (double) ((float) (l + b0) * f5 + f9), (double) ((float) (i1 + b0) * f5 + f10)); tessellator.addVertexWithUV((double) (l + b0), (double) f8, (double) (i1 + 0), (double) ((float) (l + b0) * f5 + f9), (double) ((float) (i1 + 0) * f5 + f10)); tessellator.addVertexWithUV((double) (l + 0), (double) f8, (double) (i1 + 0), (double) ((float) (l + 0) * f5 + f9), (double) ((float) (i1 + 0) * f5 + f10)); } } tessellator.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); } } }
From source file:mods.cloudmaster.CloudRenderer.java
/** * Renders the 3d fancy clouds/*from w w w. j a v a 2 s . c o m*/ */ public void renderCloudsFancy(float par1, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_CULL_FACE); float f1 = (float) (mc.renderViewEntity.lastTickPosY + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * (double) par1); Tessellator tessellator = Tessellator.instance; float f2 = 12.0F; float f3 = 4.0F; double d0 = (double) ((float) cloudTickCounter + par1); double d1 = (mc.renderViewEntity.prevPosX + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * (double) par1 + d0 * 0.029999999329447746D) / (double) f2; double d2 = (mc.renderViewEntity.prevPosZ + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * (double) par1) / (double) f2 + 0.33000001311302185D; float f4 = getCloudHeight() - f1 + 0.33F; int i = MathHelper.floor_double(d1 / 2048.0D); int j = MathHelper.floor_double(d2 / 2048.0D); d1 -= (double) (i * 2048); d2 -= (double) (j * 2048); mc.renderEngine.bindTexture(CLOUD_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Vec3 vec3 = world.getCloudColour(par1); float f5 = (float) vec3.xCoord; float f6 = (float) vec3.yCoord; float f7 = (float) vec3.zCoord; float f8; float f9; float f10; if (mc.gameSettings.anaglyph) { f8 = (f5 * 30.0F + f6 * 59.0F + f7 * 11.0F) / 100.0F; f10 = (f5 * 30.0F + f6 * 70.0F) / 100.0F; f9 = (f5 * 30.0F + f7 * 70.0F) / 100.0F; f5 = f8; f6 = f10; f7 = f9; } f8 = (float) (d1 * 0.0D); f10 = (float) (d2 * 0.0D); f9 = 0.00390625F; f8 = (float) MathHelper.floor_double(d1) * f9; f10 = (float) MathHelper.floor_double(d2) * f9; float f11 = (float) (d1 - (double) MathHelper.floor_double(d1)); float f12 = (float) (d2 - (double) MathHelper.floor_double(d2)); byte b0 = 8; byte b1 = 4; float f13 = 9.765625E-4F; GL11.glScalef(f2, 1.0F, f2); for (int k = 0; k < 2; ++k) { if (k == 0) { GL11.glColorMask(false, false, false, false); } else if (mc.gameSettings.anaglyph) { if (EntityRenderer.anaglyphField == 0) { GL11.glColorMask(false, true, true, true); } else { GL11.glColorMask(true, false, false, true); } } else { GL11.glColorMask(true, true, true, true); } for (int l = -b1 + 1; l <= b1; ++l) { for (int i1 = -b1 + 1; i1 <= b1; ++i1) { tessellator.startDrawingQuads(); float f14 = (float) (l * b0); float f15 = (float) (i1 * b0); float f16 = f14 - f11; float f17 = f15 - f12; if (f4 > -f3 - 1.0F) { tessellator.setColorRGBA_F(f5 * 0.7F, f6 * 0.7F, f7 * 0.7F, 0.8F); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } if (f4 <= f3 + 1.0F) { tessellator.setColorRGBA_F(f5, f6, f7, 0.8F); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3 - f13), (double) (f17 + (float) b0), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3 - f13), (double) (f17 + (float) b0), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3 - f13), (double) (f17 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3 - f13), (double) (f17 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } tessellator.setColorRGBA_F(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.8F); int j1; if (l > -1) { tessellator.setNormal(-1.0F, 0.0F, 0.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + f3), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + f3), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } } if (l <= 1) { tessellator.setNormal(1.0F, 0.0F, 0.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + f3), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + f3), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } } tessellator.setColorRGBA_F(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.8F); if (i1 > -1) { tessellator.setNormal(0.0F, 0.0F, -1.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); } } if (i1 <= 1) { tessellator.setNormal(0.0F, 0.0F, 1.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); } } tessellator.draw(); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:mods.railcraft.client.render.carts.CartContentRendererCargo.java
License:Open Source License
@Override public void render(RenderCart renderer, EntityMinecart cart, float light, float time) { super.render(renderer, cart, light, time); GL11.glPushMatrix();/* w w w .j a va2 s . c o m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glTranslatef(0.0F, 0.3125F, 0.0F); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int x = (int) (Math.floor(cart.posX)); int y = (int) (Math.floor(cart.posY)); int z = (int) (Math.floor(cart.posZ)); EntityCartCargo cartCargo = (EntityCartCargo) cart; renderCargo(renderer, cartCargo, light, time, x, y, z); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.carts.CartContentRendererRedstoneFlux.java
License:Open Source License
@Override public void render(RenderCart renderer, EntityMinecart cart, float light, float time) { super.render(renderer, cart, light, time); GL11.glPushMatrix();/*from w w w. ja v a 2 s.co m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glTranslatef(0.0F, 0.3125F, 0.0F); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int x = (int) (Math.floor(cart.posX)); int y = (int) (Math.floor(cart.posY)); int z = (int) (Math.floor(cart.posZ)); EntityCartRF cartRF = (EntityCartRF) cart; renderer.bindTex(TextureMap.locationBlocksTexture); GL11.glTranslatef(0, 0.0625f, 0); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); RenderFakeBlock.renderBlockForEntity(leadFrame, cart.worldObj, x, y, z, false, true); float scale = 0.99F; GL11.glScalef(scale, scale, scale); float bright = 0.5F + 0.5F * (float) ((double) cartRF.getRF() / (double) cartRF.getMaxRF()); GL11.glColor4f(bright, bright, bright, 1.0f); RenderFakeBlock.renderBlockForEntity(redBlock, cart.worldObj, x, y, z, false, true); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.carts.CartContentRendererTank.java
License:Open Source License
@Override public void render(RenderCart renderer, EntityMinecart cart, float light, float time) { super.render(renderer, cart, light, time); GL11.glPushMatrix();//from ww w . j av a 2 s.co m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glTranslatef(0.0F, 0.3125F, 0.0F); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int x = (int) (Math.floor(cart.posX)); int y = (int) (Math.floor(cart.posY)); int z = (int) (Math.floor(cart.posZ)); renderTank(renderer, cart, light, time, x, y, z); EntityCartTank cartTank = (EntityCartTank) cart; renderFilterItem(renderer, cartTank, light, time, x, y, z); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.carts.CartContentRendererTNT.java
License:Open Source License
@Override public void render(RenderCart renderer, EntityMinecart cart, float light, float time) { GL11.glPushMatrix();//w w w . jav a 2 s . c o m // GL11.glTranslatef(0.0F, 0.3125F, 0.0F); // GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); CartExplosiveBase tnt = (CartExplosiveBase) cart; if (tnt.isPrimed() && ((float) tnt.getFuse() - time) + 1.0F < 10F) { float scale = 1.0F - (((float) tnt.getFuse() - time) + 1.0F) / 10F; if (scale < 0.0F) { scale = 0.0F; } if (scale > 1.0F) { scale = 1.0F; } scale *= scale; scale *= scale; scale = 1.0F + scale * 0.3F; GL11.glScalef(scale, scale, scale); } super.render(renderer, cart, light, time); if (tnt.isPrimed() && (tnt.getFuse() / 5) % 2 == 0) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 772); float alpha = (1.0F - (((float) tnt.getFuse() - time) + 1.0F) / 100F) * 0.8F; GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); GL11.glScalef(1.01f, 1.01f, 1.01f); super.render(renderer, cart, 1, time); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopAttrib(); } GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.carts.LocomotiveRendererDefault.java
License:Open Source License
@Override public void renderLocomotive(IRenderer renderer, EntityMinecart cart, int primaryColor, int secondaryColor, ResourceLocation emblemTexture, float light, float time) { GL11.glPushMatrix();//from w ww . j av a 2 s . c o m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glScalef(-1F, -1F, 1.0F); color[0] = primaryColor; color[1] = secondaryColor; for (int pass = 0; pass < textures.length; pass++) { renderer.bindTex(textures[pass]); int c = color[pass]; float dim = 1.0F; float c1 = (float) (c >> 16 & 255) / 255.0F; float c2 = (float) (c >> 8 & 255) / 255.0F; float c3 = (float) (c & 255) / 255.0F; GL11.glColor4f(c1 * dim, c2 * dim, c3 * dim, 1); model.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); } GL11.glPopAttrib(); if (emblemTexture != null) { renderer.bindTex(emblemTexture); Tessellator tess = Tessellator.instance; // float size = 0.22F; // float offsetX = -0.25F; // float offsetY = -0.25F; // float offsetZ = -0.46F; tess.startDrawingQuads(); tess.addVertexWithUV(emblemOffsetX - emblemSize, emblemOffsetY - emblemSize, emblemOffsetZ, 0, 0); tess.addVertexWithUV(emblemOffsetX - emblemSize, emblemOffsetY + emblemSize, emblemOffsetZ, 0, 1); tess.addVertexWithUV(emblemOffsetX + emblemSize, emblemOffsetY + emblemSize, emblemOffsetZ, 1, 1); tess.addVertexWithUV(emblemOffsetX + emblemSize, emblemOffsetY + -emblemSize, emblemOffsetZ, 1, 0); tess.addVertexWithUV(emblemOffsetX + emblemSize, emblemOffsetY + -emblemSize, -emblemOffsetZ, 0, 0); tess.addVertexWithUV(emblemOffsetX + emblemSize, emblemOffsetY + emblemSize, -emblemOffsetZ, 0, 1); tess.addVertexWithUV(emblemOffsetX - emblemSize, emblemOffsetY + emblemSize, -emblemOffsetZ, 1, 1); tess.addVertexWithUV(emblemOffsetX - emblemSize, emblemOffsetY - emblemSize, -emblemOffsetZ, 1, 0); tess.draw(); } GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.carts.LocomotiveRendererElectric.java
License:Open Source License
@Override public void renderLocomotive(IRenderer renderer, EntityMinecart cart, int primaryColor, int secondaryColor, ResourceLocation emblemTexture, float light, float time) { super.renderLocomotive(renderer, cart, primaryColor, secondaryColor, emblemTexture, light, time); GL11.glPushMatrix();//from www. j a v a2 s . c o m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glScalef(-1F, -1F, 1.0F); GL11.glTranslatef(0.05F, 0.0F, 0.0F); if (((EntityLocomotive) cart).getMode() == EntityLocomotive.LocoMode.RUNNING) { renderer.bindTex(LAMP_TEX_ON); LAMP_ON.render(cart, -0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); } else { renderer.bindTex(LAMP_TEX_OFF); LAMP_OFF.render(cart, -0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.carts.RenderCartItemFiltered.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { GL11.glPushMatrix();/*from ww w . j ava2s . c o m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); IIcon cartTexture = stack.getIconIndex(); renderItem.renderIcon(0, 0, cartTexture, 16, 16); ItemStack filter = EntityCartFiltered.getFilterFromCartItem(stack); if (filter != null) { rendererType.setupRender(); RenderItem.getInstance().renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), filter, 0, 0); } GL11.glPopAttrib(); GL11.glPopMatrix(); }