List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:buildcraft.core.render.BlockHighlightHandler.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) @SubscribeEvent/* w w w . ja va 2 s. com*/ public void handleBlockHighlight(DrawBlockHighlightEvent e) { if (e.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = e.target.blockX; int y = e.target.blockY; int z = e.target.blockZ; Block block = e.player.worldObj.getBlock(x, y, z); if (block instanceof ICustomHighlight) { AxisAlignedBB[] aabbs = ((ICustomHighlight) block).getBoxes(e.player.worldObj, x, y, z, e.player); Vec3 pos = e.player.getPosition(e.partialTicks); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); double exp = ((ICustomHighlight) block).getExpansion(); for (AxisAlignedBB aabb : aabbs) { RenderGlobal.drawOutlinedBoundingBox(aabb.copy().expand(exp, exp, exp).offset(x, y, z) .offset(-pos.xCoord, -pos.yCoord, -pos.zCoord), -1); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); e.setCanceled(true); } } }
From source file:buildcraft.core.render.FluidRenderer.java
License:Minecraft Mod Public
public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) { if (fluidStack == null) { return null; }// ww w .java 2s .c om Fluid fluid = fluidStack.getFluid(); if (fluid == null) { return null; } Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache; int[] diplayLists = cache.get(fluid); if (diplayLists != null) { return diplayLists; } diplayLists = new int[DISPLAY_STAGES]; if (fluid.getBlock() != null) { liquidBlock.baseBlock = fluid.getBlock(); liquidBlock.texture = getFluidTexture(fluidStack, flowing); } else { liquidBlock.baseBlock = Blocks.water; liquidBlock.texture = getFluidTexture(fluidStack, flowing); } cache.put(fluid, diplayLists); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); for (int s = 0; s < DISPLAY_STAGES; ++s) { diplayLists[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/); liquidBlock.minX = 0.01f; liquidBlock.minY = 0; liquidBlock.minZ = 0.01f; liquidBlock.maxX = 0.99f; liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES; liquidBlock.maxZ = 0.99f; RenderEntityBlock.INSTANCE.renderBlock(liquidBlock, world, 0, 0, 0, false, true); GL11.glEndList(); } GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); return diplayLists; }
From source file:buildcraft.core.render.LiquidRenderer.java
License:Minecraft Mod Public
public static int[] getLiquidDisplayLists(LiquidStack liquid, World world, boolean flowing) { if (liquid == null) { return null; }//from ww w . j av a 2 s. c o m liquid = liquid.canonical(); if (liquid == null) { throw new LiquidCanonException(liquid); } Map<LiquidStack, int[]> cache = flowing ? flowingRenderCache : stillRenderCache; int[] diplayLists = cache.get(liquid); if (diplayLists != null) { return diplayLists; } diplayLists = new int[DISPLAY_STAGES]; if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null) { liquidBlock.baseBlock = Block.blocksList[liquid.itemID]; if (!flowing) { liquidBlock.texture = getLiquidTexture(liquid); } } else if (Item.itemsList[liquid.itemID] != null) { liquidBlock.baseBlock = Block.waterStill; liquidBlock.texture = getLiquidTexture(liquid); } else { return null; } cache.put(liquid, diplayLists); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); ItemStack stack = liquid.asItemStack(); int color = stack.getItem().getColorFromItemStack(stack, 0); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; GL11.glColor4f(c1, c2, c3, 1); for (int s = 0; s < DISPLAY_STAGES; ++s) { diplayLists[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/); liquidBlock.minX = 0.01f; liquidBlock.minY = 0; liquidBlock.minZ = 0.01f; liquidBlock.maxX = 0.99f; liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES; liquidBlock.maxZ = 0.99f; RenderEntityBlock.renderBlock(liquidBlock, world, 0, 0, 0, false, true); GL11.glEndList(); } GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); return diplayLists; }
From source file:buildcraft.core.render.RenderBox.java
License:Minecraft Mod Public
public static void doRender(TextureManager t, ResourceLocation texture, Box box) { GL11.glPushMatrix();/*from w ww . j av a 2 s . c o m*/ GL11.glDisable(2896 /* GL_LIGHTING */); box.createLaserData(); for (LaserData l : box.lasersData) { l.update(); GL11.glPushMatrix(); GL11.glTranslated(0.5F, 0.5F, 0.5F); RenderLaser.doRenderLaser(t, l, texture); GL11.glPopMatrix(); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double i, double j, double k) { if (entity.isDead) { return;// ww w . ja v a 2 s .c om } shadowSize = entity.shadowSize; World world = entity.worldObj; RenderInfo util = new RenderInfo(); util.texture = entity.texture; bindTexture(TextureMap.locationBlocksTexture); for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glTranslatef((float) i, (float) j, (float) k); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, 0, 0, 0, lightX, lightY, lightZ, false, true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } } }
From source file:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
private void doRender(EntityLaser laser, double x, double y, double z, float f, float f1) { if (!laser.isVisible() || laser.getTexture() == null) { return;/*from w w w .j a v a2 s . c om*/ } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); Position offset = laser.renderOffset(); GL11.glTranslated(x + offset.x, y + offset.y, z + offset.z); // FIXME: WARNING! not using getBox (laser) will kill laser movement. // we can use some other method for the animation though. doRenderLaser(renderManager.renderEngine, laser.data, laser.getTexture()); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderRobot.java
License:Minecraft Mod Public
private void doRender(EntityRobot robot, double x, double y, double z, float f, float f1) { GL11.glPushMatrix();// ww w . ja v a 2 s . c om GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x, y, z); renderManager.renderEngine.bindTexture(robot.getTexture()); float factor = (float) (1.0 / 16.0); box.render(factor); if (robot.laser.isVisible) { robot.laser.head.x = robot.posX; robot.laser.head.y = robot.posY; robot.laser.head.z = robot.posZ; RenderLaser.doRenderLaser(renderManager.renderEngine, robot.laser, EntityLaser.LASER_TEXTURES[1]); } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderRobot.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) { return;//from w w w . ja v a 2 s.c o m } RenderBlocks renderBlocks = (RenderBlocks) data[0]; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); // FIXME: Texture localisation should be factorized between items and // entities. if (item.getItem() == BuildCraftCore.robotBaseItem) { RenderManager.instance.renderEngine.bindTexture(TEXTURE_BASE); } else if (item.getItem() == BuildCraftCore.robotBuilderItem) { RenderManager.instance.renderEngine.bindTexture(TEXTURE_BUILDER); } else if (item.getItem() == BuildCraftCore.robotPickerItem) { RenderManager.instance.renderEngine.bindTexture(TEXTURE_PICKER); } float factor = (float) (1.0 / 16.0); if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslated(0.25F, 0.5F, 0); } box.render(1F / 16F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:buildcraft.core.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double i, double j, double k) { if (entity.isDead) return;//from w w w . j a v a 2s . c o m shadowSize = entity.shadowSize; World world = entity.worldObj; BlockInterface util = new BlockInterface(); util.texture = entity.texture; for (int iBase = 0; iBase < entity.iSize; ++iBase) for (int jBase = 0; jBase < entity.jSize; ++jBase) for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = (remainX > 1.0 ? 1.0 : remainX); util.maxY = (remainY > 1.0 ? 1.0 : remainY); util.maxZ = (remainZ > 1.0 ? 1.0 : remainZ); GL11.glPushMatrix(); GL11.glTranslatef((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_BLOCKS); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, lightX, lightY, lightZ, false, true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } }
From source file:buildcraft.energy.render.RenderEnergyEmitter.java
License:Minecraft Mod Public
public void renderTileEntityAt2(TileEntity tileentity, double x, double y, double z, float f) { if (BuildCraftCore.render == RenderMode.NoDynamic) { return;// ww w. j av a 2s. c o m } 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; float[] angle = { 0, 0, 0 }; box.rotateAngleX = angle[0]; box.rotateAngleY = angle[1]; box.rotateAngleZ = angle[2]; float factor = (float) (1.0 / 16.0); //bindTexture(EntityLaser.LASER_TEXTURES[3]); bindTexture(CHAMBER_TEXTURE); box.render(factor); GL11.glPopAttrib(); GL11.glPopMatrix(); }