List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:buildcraft.energy.render.RenderEngine.java
License:Minecraft Mod Public
private void render(float progress, ForgeDirection orientation, ResourceLocation baseTexture, ResourceLocation chamberTexture, ResourceLocation trunkTexture, double x, double y, double z) { if (BuildCraftCore.render == RenderMode.NoDynamic) { return;/* www . java2 s.c om*/ } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); float step; if (progress > 0.5) { step = 7.99F - (progress - 0.5F) * 2F * 7.99F; } else { step = progress * 2F * 7.99F; } float translatefact = step / 16; float[] angle = { 0, 0, 0 }; float[] translate = { orientation.offsetX, orientation.offsetY, orientation.offsetZ }; switch (orientation) { case EAST: case WEST: case DOWN: angle[2] = angleMap[orientation.ordinal()]; break; case SOUTH: case NORTH: default: angle[0] = angleMap[orientation.ordinal()]; break; } box.rotateAngleX = angle[0]; box.rotateAngleY = angle[1]; box.rotateAngleZ = angle[2]; trunk.rotateAngleX = angle[0]; trunk.rotateAngleY = angle[1]; trunk.rotateAngleZ = angle[2]; movingBox.rotateAngleX = angle[0]; movingBox.rotateAngleY = angle[1]; movingBox.rotateAngleZ = angle[2]; chamber.rotateAngleX = angle[0]; chamber.rotateAngleY = angle[1]; chamber.rotateAngleZ = angle[2]; float factor = (float) (1.0 / 16.0); bindTexture(baseTexture); box.render(factor); GL11.glTranslatef(translate[0] * translatefact, translate[1] * translatefact, translate[2] * translatefact); movingBox.render(factor); GL11.glTranslatef(-translate[0] * translatefact, -translate[1] * translatefact, -translate[2] * translatefact); bindTexture(chamberTexture); float chamberf = 2F / 16F; for (int i = 0; i <= step + 2; i += 2) { chamber.render(factor); GL11.glTranslatef(translate[0] * chamberf, translate[1] * chamberf, translate[2] * chamberf); } for (int i = 0; i <= step + 2; i += 2) { GL11.glTranslatef(-translate[0] * chamberf, -translate[1] * chamberf, -translate[2] * chamberf); } bindTexture(trunkTexture); trunk.render(factor); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.energy.RenderEngine.java
License:Minecraft Mod Public
private void render(EnergyStage energy, float progress, Orientations orientation, String baseTexture, double x, double y, double z) { if (BuildCraftCore.render == RenderMode.NoDynamic) return;// w w w. j av a2 s. c om GL11.glPushMatrix(); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glTranslatef((float) x, (float) y, (float) z); float step; if (progress > 0.5) step = 7.99F - (progress - 0.5F) * 2F * 7.99F; else step = progress * 2F * 7.99F; float[] angle = { 0, 0, 0 }; float[] translate = { 0, 0, 0 }; float translatefact = step / 16; switch (orientation) { case XPos: angle[2] = (float) -Math.PI / 2; translate[0] = 1; break; case XNeg: angle[2] = (float) Math.PI / 2; translate[0] = -1; break; case YPos: translate[1] = 1; break; case YNeg: angle[2] = (float) Math.PI; translate[1] = -1; break; case ZPos: angle[0] = (float) Math.PI / 2; translate[2] = 1; break; case ZNeg: angle[0] = (float) -Math.PI / 2; translate[2] = -1; break; } box.rotateAngleX = angle[0]; box.rotateAngleY = angle[1]; box.rotateAngleZ = angle[2]; trunk.rotateAngleX = angle[0]; trunk.rotateAngleY = angle[1]; trunk.rotateAngleZ = angle[2]; movingBox.rotateAngleX = angle[0]; movingBox.rotateAngleY = angle[1]; movingBox.rotateAngleZ = angle[2]; chamber.rotateAngleX = angle[0]; chamber.rotateAngleY = angle[1]; chamber.rotateAngleZ = angle[2]; float factor = (float) (1.0 / 16.0); MinecraftForgeClient.bindTexture(baseTexture); box.render(factor); GL11.glTranslatef(translate[0] * translatefact, translate[1] * translatefact, translate[2] * translatefact); movingBox.render(factor); GL11.glTranslatef(-translate[0] * translatefact, -translate[1] * translatefact, -translate[2] * translatefact); MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber.png"); float chamberf = 2F / 16F; for (int i = 0; i <= step + 2; i += 2) { chamber.render(factor); GL11.glTranslatef(translate[0] * chamberf, translate[1] * chamberf, translate[2] * chamberf); } for (int i = 0; i <= step + 2; i += 2) GL11.glTranslatef(-translate[0] * chamberf, -translate[1] * chamberf, -translate[2] * chamberf); String texture = ""; switch (energy) { case Blue: texture = DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_blue.png"; break; case Green: texture = DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_green.png"; break; case Yellow: texture = DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_yellow.png"; break; default: texture = DefaultProps.TEXTURE_PATH_BLOCKS + "/trunk_red.png"; break; } MinecraftForgeClient.bindTexture(texture); trunk.render(factor); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.factory.render.RenderHopper.java
License:Minecraft Mod Public
private void render(double x, double y, double z) { if (BuildCraftCore.render == RenderMode.NoDynamic) { return;/* w w w . ja va 2 s . c om*/ } GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x, y, z); bindTexture(HOPPER_TEXTURE); top.render((float) (1.0 / 16.0)); bottom.render((float) (1.0 / 16.0)); bindTexture(HOPPER_MIDDLE_TEXTURE); middle.render(Tessellator.instance, 1F / 16F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:buildcraft.factory.render.RenderRefinery.java
License:Minecraft Mod Public
private void render(TileRefinery tile, double x, double y, double z) { FluidStack liquid1 = null, liquid2 = null, liquidResult = null; int color1 = 0xFFFFFF, color2 = 0xFFFFFF, colorResult = 0xFFFFFF; float anim = 0; int angle = 0; ModelRenderer theMagnet = magnet[0]; if (tile != null) { if (tile.tank1.getFluid() != null) { liquid1 = tile.tank1.getFluid(); color1 = tile.tank1.colorRenderCache; }// w w w. j a va 2 s.co m if (tile.tank2.getFluid() != null) { liquid2 = tile.tank2.getFluid(); color2 = tile.tank2.colorRenderCache; } if (tile.result.getFluid() != null) { liquidResult = tile.result.getFluid(); colorResult = tile.result.colorRenderCache; } anim = tile.getAnimationStage(); angle = 0; switch (tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) { case 2: angle = 90; break; case 3: angle = 270; break; case 4: angle = 180; break; case 5: angle = 0; break; } if (tile.animationSpeed <= 1) { theMagnet = magnet[0]; } else if (tile.animationSpeed <= 2.5) { theMagnet = magnet[1]; } else if (tile.animationSpeed <= 4.5) { theMagnet = magnet[2]; } else { theMagnet = magnet[3]; } } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glRotatef(angle, 0, 1, 0); bindTexture(TEXTURE); GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glTranslatef(-4F * pixel, 0, -4F * pixel); tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, 4F * pixel); GL11.glTranslatef(-4F * pixel, 0, 4F * pixel); tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, -4F * pixel); GL11.glTranslatef(4F * pixel, 0, 0); tank.render(pixel); GL11.glTranslatef(-4F * pixel, 0, 0); GL11.glPopMatrix(); float trans1, trans2; if (anim <= 100) { trans1 = 12F * pixel * anim / 100F; trans2 = 0; } else if (anim <= 200) { trans1 = 12F * pixel - (12F * pixel * (anim - 100F) / 100F); trans2 = 12F * pixel * (anim - 100F) / 100F; } else { trans1 = 12F * pixel * (anim - 200F) / 100F; trans2 = 12F * pixel - (12F * pixel * (anim - 200F) / 100F); } GL11.glPushMatrix(); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F); theMagnet.render(pixel); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F); theMagnet.render(pixel); GL11.glPopMatrix(); if (tile != null) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glScalef(0.5F, 1, 0.5F); if (liquid1 != null && liquid1.amount > 0) { int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.getWorldObj(), false); if (list1 != null) { bindTexture(FluidRenderer.getFluidSheet(liquid1)); RenderUtils.setGLColorFromInt(color1); GL11.glCallList(list1[getDisplayListIndex(tile.tank1)]); } } if (liquid2 != null && liquid2.amount > 0) { int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.getWorldObj(), false); if (list2 != null) { GL11.glPushMatrix(); GL11.glTranslatef(0, 0, 1); bindTexture(FluidRenderer.getFluidSheet(liquid2)); RenderUtils.setGLColorFromInt(color2); GL11.glCallList(list2[getDisplayListIndex(tile.tank2)]); GL11.glPopMatrix(); } } if (liquidResult != null && liquidResult.amount > 0) { int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.getWorldObj(), false); if (list3 != null) { GL11.glPushMatrix(); GL11.glTranslatef(1, 0, 0.5F); bindTexture(FluidRenderer.getFluidSheet(liquidResult)); RenderUtils.setGLColorFromInt(colorResult); GL11.glCallList(list3[getDisplayListIndex(tile.result)]); GL11.glPopMatrix(); } } GL11.glPopAttrib(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.factory.render.RenderTank.java
License:Minecraft Mod Public
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { TileTank tank = (TileTank) tileentity; FluidStack liquid = tank.tank.getFluid(); int color = tank.tank.colorRenderCache; if (liquid == null || liquid.amount <= 0) { return;/*from w ww .j a v a2 s .c om*/ } int[] displayList = FluidRenderer.getFluidDisplayLists(liquid, tileentity.getWorldObj(), false); if (displayList == null) { return; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bindTexture(FluidRenderer.getFluidSheet(liquid)); RenderUtils.setGLColorFromInt(color); GL11.glTranslatef((float) x + 0.125F, (float) y + 0.5F, (float) z + 0.125F); GL11.glScalef(0.75F, 0.999F, 0.75F); GL11.glTranslatef(0, -0.5F, 0); GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.tank.getCapacity()) * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.factory.RenderRefinery.java
License:Minecraft Mod Public
private void render(TileRefinery tile, double x, double y, double z) { int liquid1 = 0, liquid2 = 0, liquid3 = 0; int qty1 = 0, qty2 = 0, qty3 = 0; float anim = 0; int angle = 0; ModelRenderer theMagnet = magnet[0]; if (tile != null) { liquid1 = tile.slot1.liquidId;//from w w w. j a va2 s. c o m qty1 = tile.slot1.quantity; liquid2 = tile.slot2.liquidId; qty2 = tile.slot2.quantity; liquid3 = tile.result.liquidId; qty3 = tile.result.quantity; anim = tile.getAnimationStage(); switch (tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) { case 2: angle = 90; break; case 3: angle = 270; break; case 4: angle = 180; break; case 5: angle = 0; break; } if (tile.animationSpeed <= 1) theMagnet = magnet[0]; else if (tile.animationSpeed <= 2.5) theMagnet = magnet[1]; else if (tile.animationSpeed <= 4.5) theMagnet = magnet[2]; else theMagnet = magnet[3]; } GL11.glPushMatrix(); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(angle, 0, 1, 0); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_PATH_BLOCKS + "/refinery.png"); GL11.glTranslatef(-4F * factor, 0, -4F * factor); tank.render(factor); GL11.glTranslatef(4F * factor, 0, 4F * factor); GL11.glTranslatef(-4F * factor, 0, 4F * factor); tank.render(factor); GL11.glTranslatef(4F * factor, 0, -4F * factor); GL11.glTranslatef(4F * factor, 0, 0); tank.render(factor); GL11.glTranslatef(-4F * factor, 0, 0); float trans1, trans2; if (anim <= 100) { trans1 = 12F * factor * anim / 100F; trans2 = 0; } else if (anim <= 200) { trans1 = 12F * factor - (12F * factor * (anim - 100F) / 100F); trans2 = 12F * factor * (anim - 100F) / 100F; } else { trans1 = 12F * factor * (anim - 200F) / 100F; trans2 = 12F * factor - (12F * factor * (anim - 200F) / 100F); } GL11.glTranslatef(0, trans1, 0); theMagnet.render(factor); GL11.glTranslatef(0, -trans1, 0); GL11.glTranslatef(0, trans2, 12F * factor); theMagnet.render(factor); GL11.glTranslatef(0, -trans2, -12F * factor); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(-4F * factor, 0, -4F * factor); if (qty1 > 0) { int[] list1 = getDisplayLists(liquid1, tile.worldObj); if (list1 != null) { setTextureFor(liquid1); GL11.glCallList( list1[(int) ((float) qty1 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]); } } GL11.glTranslatef(4F * factor, 0, 4F * factor); GL11.glTranslatef(-4F * factor, 0, 4F * factor); if (qty2 > 0) { int[] list2 = getDisplayLists(liquid2, tile.worldObj); if (list2 != null) { setTextureFor(liquid2); GL11.glCallList( list2[(int) ((float) qty2 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]); } } GL11.glTranslatef(4F * factor, 0, -4F * factor); GL11.glTranslatef(4F * factor, 0, 0); if (qty3 > 0) { int[] list3 = getDisplayLists(liquid3, tile.worldObj); if (list3 != null) { setTextureFor(liquid3); GL11.glCallList(getDisplayLists(liquid3, tile.worldObj)[(int) ((float) qty3 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]); } } GL11.glTranslatef(-4F * factor, 0, 0); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.factory.RenderTank.java
License:Minecraft Mod Public
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { TileTank tank = ((TileTank) tileentity); LiquidStack liquid = tank.tank.getLiquid(); if (liquid == null || liquid.amount <= 0 || liquid.itemID <= 0) return;// w w w. ja va2 s .co m int[] displayList = getDisplayLists(liquid.itemID, liquid.itemMeta, tileentity.worldObj); GL11.glPushMatrix(); GL11.glDisable(2896 /* GL_LIGHTING */); Object obj = null; if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null) obj = Block.blocksList[liquid.itemID]; else obj = Item.itemsList[liquid.itemID]; if (obj instanceof ITextureProvider) MinecraftForgeClient.bindTexture(((ITextureProvider) obj).getTextureFile()); else MinecraftForgeClient.bindTexture("/terrain.png"); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.tank.getCapacity()) * (displayStages - 1))]); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.robotics.gui.GuiZonePlan.java
License:Minecraft Mod Public
@Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { super.drawGuiContainerBackgroundLayer(f, x, y); if (getContainer().mapTexture.width <= WINDOWED_MAP_WIDTH) { mapXMin = guiLeft + 8 + ((WINDOWED_MAP_WIDTH - getContainer().mapTexture.width) / 2); } else {//from w w w .ja va 2 s . c om mapXMin = (width - getContainer().mapTexture.width) / 2; } if (getContainer().mapTexture.height <= WINDOWED_MAP_HEIGHT) { mapYMin = guiTop + 9 + ((WINDOWED_MAP_HEIGHT - getContainer().mapTexture.height) / 2); } else { mapYMin = (height - getContainer().mapTexture.height) / 2; } getContainer().mapTexture.draw(mapXMin, mapYMin, zLevel); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); currentSelection.draw(mapXMin, mapYMin, zLevel); GL11.glPopAttrib(); GL11.glDisable(GL11.GL_BLEND); newSelection.updateTexture(); if (inSelection && selX2 != 0) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); int x1 = selX1 < selX2 ? selX1 : selX2; int x2 = selX1 < selX2 ? selX2 : selX1; int y1 = selY1 < selY2 ? selY1 : selY2; int y2 = selY1 < selY2 ? selY2 : selY1; drawTexturedModalRect(x1, y1, 0, 0, x2 - x1 + 1, y2 - y1 + 1); GL11.glPopAttrib(); GL11.glDisable(GL11.GL_BLEND); } if (!isFullscreen()) { drawBackgroundSlots(x, y); bindTexture(texture); GL11.glEnable(GL11.GL_ALPHA_TEST); drawTexturedModalRect(guiLeft + colorSelected.x, guiTop + colorSelected.y, 0, 228, 16, 16); drawTexturedModalRect(guiLeft + 236, guiTop + 27, 16, 228, 8, (int) ((zonePlan.progress / (float) TileZonePlan.CRAFT_TIME) * 27)); } }
From source file:buildcraft.robotics.render.RenderRobot.java
License:Minecraft Mod Public
private void doRenderRobot(float factor, TextureManager texManager, float storagePercent, boolean isAsleep) { box.render(factor);// w w w . j a v a2 s . co m if (!isAsleep) { float lastBrightnessX = OpenGlHelper.lastBrightnessX; float lastBrightnessY = OpenGlHelper.lastBrightnessY; GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glColor4f(1.0F, 1.0F, 1.0F, storagePercent); texManager.bindTexture(overlay_red); box.render(factor); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texManager.bindTexture(overlay_cyan); box.render(factor); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); } }
From source file:buildcraft.robots.render.RenderRobot.java
License:Minecraft Mod Public
private void doRenderRobot(float factor, TextureManager texManager) { box.render(factor);//from ww w . ja va 2 s . c o m GL11.glPushMatrix(); texManager.bindTexture(overlay); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDepthMask(true); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680, 0); box.render(factor); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }