List of usage examples for org.lwjgl.opengl GL11 glPushAttrib
public static native void glPushAttrib(@NativeType("GLbitfield") int mask);
From source file:mods.railcraft.client.render.RenderFluidLoader.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { TileLoaderFluidBase base = (TileLoaderFluidBase) tile; GL11.glPushMatrix();/* w ww. j a va 2 s . com*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_CULL_FACE); backDrop.texture[0] = base.getMachineType().getTexture(7); bindTexture(TextureMap.locationBlocksTexture); RenderFakeBlock.renderBlock(backDrop, base.getWorld(), x, y, z, false, true); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glScalef(1f, 0.6f, 1f); StandardTank tank = base.getTankManager().get(0); if (tank.renderData.fluid != null && tank.renderData.amount > 0) { int[] displayLists = FluidRenderer.getLiquidDisplayLists(tank.renderData.fluid); if (displayLists != null) { GL11.glPushMatrix(); if (FluidRenderer.getFluidTexture(tank.renderData.fluid, false) != null) { float cap = tank.getCapacity(); float level = (float) Math.min(tank.renderData.amount, cap) / cap; bindTexture(FluidRenderer.getFluidSheet(tank.renderData.fluid)); FluidRenderer.setColorForTank(tank); GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]); } GL11.glPopMatrix(); } } // GL11.glScalef(0.994f, 1.05f, 0.994f); GL11.glPopAttrib(); GL11.glPopMatrix(); if (tile.getClass() == TileFluidLoader.class) { TileFluidLoader loader = (TileFluidLoader) tile; pipe.minY = RenderTools.PIXEL - loader.getPipeLenght(); RenderFakeBlock.renderBlock(pipe, loader.getWorld(), x, y, z, false, true); } }
From source file:mods.railcraft.client.render.RenderIronTank.java
License:Open Source License
private void preGL() { GL11.glPushMatrix();/*from w w w . j ava 2 s . c om*/ 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); }
From source file:mods.railcraft.client.render.RenderLiquidLoader.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { TileLoaderLiquidBase base = (TileLoaderLiquidBase) tile; GL11.glPushMatrix();// w ww . j ava 2 s .co m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_CULL_FACE); backDrop.texture[0] = base.getMachineType().getTexture(7); bindTexture(TextureMap.locationBlocksTexture); RenderFakeBlock.renderBlock(backDrop, base.getWorld(), x, y, z, false, true); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glScalef(1f, 0.6f, 1f); IFluidTank tank = base.getTankManager().get(0); FluidStack fluidStack = tank.getFluid(); if (fluidStack != null && fluidStack.amount > 0) { int[] displayLists = FluidRenderer.getLiquidDisplayLists(fluidStack); if (displayLists != null) { GL11.glPushMatrix(); if (FluidRenderer.getFluidTexture(fluidStack, false) != null) { float cap = tank.getCapacity(); float level = (float) Math.min(fluidStack.amount, cap) / cap; bindTexture(FluidRenderer.getFluidSheet(fluidStack)); FluidRenderer.setColorForFluidStack(fluidStack); GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]); } GL11.glPopMatrix(); } } // GL11.glScalef(0.994f, 1.05f, 0.994f); GL11.glPopAttrib(); GL11.glPopMatrix(); if (tile.getClass() == TileLiquidLoader.class) { TileLiquidLoader loader = (TileLiquidLoader) tile; pipe.minY = RenderTools.PIXEL - loader.getPipeLenght(); RenderFakeBlock.renderBlock(pipe, loader.getWorld(), x, y, z, false, true); } }
From source file:mods.railcraft.client.render.RenderPneumaticEngine.java
License:Open Source License
private void render(EnergyStage energy, float progress, ForgeDirection orientation, double x, double y, double z) { GL11.glPushMatrix();/*from w w w.ja v a2s.c o m*/ 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[] 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: angle[0] = angleMap[orientation.ordinal()]; break; } base.setRotation(angle[0], angle[1], angle[2]); trunk.rotate(angle[0], angle[1], angle[2]); frame.setRotation(angle[0], angle[1], angle[2]); piston.setRotation(angle[0], angle[1], angle[2]); float factor = (float) (1.0 / 16.0); bindTexture(texture); trunk.render(energy, factor); base.render(factor); float step; if (progress > 0.5) { step = 7.99F - (progress - 0.5F) * 2F * 7.99F; } else { step = progress * 2F * 7.99F; } float frameTrans = step / 16; GL11.glTranslatef(translate[0] * frameTrans, translate[1] * frameTrans, translate[2] * frameTrans); frame.render(factor); GL11.glTranslatef(-translate[0] * frameTrans, -translate[1] * frameTrans, -translate[2] * frameTrans); float pistonPrep = 0.01f; GL11.glTranslatef(-translate[0] * pistonPrep, -translate[1] * pistonPrep, -translate[2] * pistonPrep); float pistonTrans = 2F / 16F; GL11.glDisable(GL11.GL_LIGHTING); for (int i = 0; i <= step + 2; i += 2) { piston.render(factor); GL11.glTranslatef(translate[0] * pistonTrans, translate[1] * pistonTrans, translate[2] * pistonTrans); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderSignal.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderblocks, ItemStack item, ItemRenderType renderType) { float pix = RenderTools.PIXEL; float min = 6 * pix; float max = 10 * pix; GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST);//from w w w . ja v a2 s. co m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); info.texture[0] = BlockSignalRailcraft.texturesSignalSingle[3]; info.texture[1] = BlockSignalRailcraft.texturesSignalSingle[3]; info.texture[2] = BlockSignalRailcraft.texturesSignalSingle[4]; info.texture[3] = BlockSignalRailcraft.texturesSignalSingle[4]; info.texture[4] = BlockSignalRailcraft.texturesSignalSingle[4]; info.texture[5] = BlockSignalRailcraft.texturesSignalSingle[4]; info.setBlockBounds(min, 0, min, max, 15 * pix, max); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.texture[0] = BlockSignalRailcraft.texturesSignalSingle[0]; info.texture[1] = BlockSignalRailcraft.texturesSignalSingle[0]; info.texture[2] = BlockSignalRailcraft.texturesSignalSingle[1]; info.texture[3] = BlockSignalRailcraft.texturesSignalSingle[2]; info.texture[4] = BlockSignalRailcraft.texturesSignalSingle[1]; info.texture[5] = BlockSignalRailcraft.texturesSignalSingle[1]; min = 3 * pix; max = 13 * pix; info.setBlockBounds(min, 6 * pix, min, max, 1, max); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.texture[3] = BlockSignalRailcraft.texturesLampTop[defaultAspect.getTextureIndex()]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1, 3); info.texture[3] = BlockSignalRailcraft.texturesSignalSingle[2]; float size = 13 * pix; info.setBlockBounds(6 * pix, 13 * pix, size, 10 * pix, 14 * pix, size + 2 * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setBlockBounds(5 * pix, 10 * pix, size, 6 * pix, 14 * pix, size + 2 * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setBlockBounds(10 * pix, 10 * pix, size, 11 * pix, 14 * pix, size + 2 * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderSignalBox.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderblocks, ItemStack item, ItemRenderType renderType) { GL11.glColor4f(1, 1, 1, 1);//from w w w . j a v a2 s . c om 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); info.override = null; float pix = RenderTools.PIXEL; info.setBlockBounds(2 * pix, 0, 2 * pix, 14 * pix, 15 * pix, 14 * pix); info.texture[0] = BlockSignalRailcraft.texturesBox[2]; info.texture[1] = iconProvider.getIcon(); info.texture[2] = BlockSignalRailcraft.texturesBox[0]; info.texture[3] = BlockSignalRailcraft.texturesBox[0]; info.texture[4] = BlockSignalRailcraft.texturesBox[0]; info.texture[5] = BlockSignalRailcraft.texturesBox[0]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); int texture = SignalAspect.RED.getTextureIndex(); info.renderSide[0] = false; info.renderSide[1] = false; info.texture[2] = BlockSignalRailcraft.texturesLampBox[texture]; info.texture[3] = BlockSignalRailcraft.texturesLampBox[texture]; info.texture[4] = BlockSignalRailcraft.texturesLampBox[texture]; info.texture[5] = BlockSignalRailcraft.texturesLampBox[texture]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setRenderAllSides(); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderSignalDual.java
License:Open Source License
@Override public void renderItem(RenderBlocks renderblocks, ItemStack item, ItemRenderType renderType) { EnumSignal signalType = EnumSignal.fromId(item.getItemDamage()); float pix = RenderTools.PIXEL; float f = 3.0F * pix; float f1 = 13.0F * pix; GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST);//from ww w . j a v a 2 s. c om GL11.glEnable(GL11.GL_BLEND); info.setBlockBounds(f, 0.0F, f, f1, 1.0F, f1); info.texture[0] = BlockSignalRailcraft.texturesSignalDual[0]; info.texture[1] = BlockSignalRailcraft.texturesSignalDual[0]; info.texture[2] = BlockSignalRailcraft.texturesSignalDual[1]; info.texture[3] = BlockSignalRailcraft.texturesSignalDual[2]; info.texture[4] = BlockSignalRailcraft.texturesSignalDual[1]; info.texture[5] = BlockSignalRailcraft.texturesSignalDual[1]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.texture[3] = BlockSignalRailcraft.texturesLampTop[signalType == EnumSignal.DUAL_HEAD_BLOCK_SIGNAL ? 0 : 2]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1, 3); info.texture[3] = BlockSignalRailcraft.texturesLampBottom[signalType == EnumSignal.DUAL_HEAD_BLOCK_SIGNAL ? 2 : 0]; RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1, 3); info.texture[3] = BlockSignalRailcraft.texturesSignalDual[2]; float temp = 13.0F * pix; for (int ii = 0; ii < 2; ii++) { info.setBlockBounds(6.0F * pix, 7.0F * pix + ii * 6.0F * pix, temp, 10.0F * pix, 8.0F * pix + ii * 6.0F * pix, temp + 2.0F * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setBlockBounds(5.0F * pix, 4.0F * pix + ii * 6.0F * pix, temp, 6.0F * pix, 8.0F * pix + ii * 6.0F * pix, temp + 2.0F * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); info.setBlockBounds(10.0F * pix, 4.0F * pix + ii * 6.0F * pix, temp, 11.0F * pix, 8.0F * pix + ii * 6.0F * pix, temp + 2.0F * pix); RenderFakeBlock.renderBlockOnInventory(renderblocks, info, 1); } GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.RenderTankCartItem.java
License:Open Source License
private void render(ItemRenderType type, ItemStack stack) { GL11.glPushMatrix();//from w w w.j a v a2 s . 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 = EntityCartTank.getFilterFromCartItem(stack); if (filter != null) { int meta = filter.getItemDamage(); float scale = 0.6f; GL11.glScalef(scale, scale, 1); GL11.glTranslatef(0, 11f, 0); if (type == ItemRenderType.ENTITY) GL11.glTranslatef(0, 0, -0.01f); for (int pass = 0; pass < filter.getItem().getRenderPasses(meta); ++pass) { IIcon bucketTexture = filter.getItem().getIconFromDamageForRenderPass(meta, pass); if (bucketTexture == null) continue; int color = filter.getItem().getColorFromItemStack(filter, pass); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; if (renderItem.renderWithColor) GL11.glColor4f(c1, c2, c3, 1.0F); renderItem.renderIcon(0, 0, bucketTexture, 16, 16); } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderTESRFirestone.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float time) { TileFirestoneRecharge firestoneTile = (TileFirestoneRecharge) tile; GL11.glPushMatrix();/*from www .ja v a2 s. co m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); // GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_CULL_FACE); float pix = RenderTools.PIXEL; float shift = 0.5F; float scale = 0.6F; float yOffset = firestoneTile.preYOffset + (firestoneTile.yOffset - firestoneTile.preYOffset) * time; GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F + yOffset, (float) z + 0.5F); // GL11.glTranslatef(shift, shift, shift); // GL11.glScalef(scale, scale, scale); // GL11.glTranslatef(-shift, -shift, -shift); // GL11.glTranslatef(0, 0, 1 - 0.02F); float yaw = firestoneTile.preRotationYaw + (firestoneTile.rotationYaw - firestoneTile.preRotationYaw) * time; GL11.glRotatef(yaw, 0, 1, 0); ItemStack firestone = tile.getBlockMetadata() == 0 ? ItemFirestoneRefined.getItemCharged() : ItemFirestoneCracked.getItemCharged(); EntityItem entityitem = new EntityItem(null, 0.0D, 0.0D, 0.0D, firestone); entityitem.getEntityItem().stackSize = 1; entityitem.hoverStart = 0.0F; RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); if (!RenderManager.instance.options.fancyGraphics) { GL11.glRotatef(180, 0, 1, 0); RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); GL11.glRotatef(-180, 0, 1, 0); } RenderItem.renderInFrame = false; GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderTESRSignals.java
License:Open Source License
private void renderPairs(TileEntity tile, double x, double y, double z, float f, AbstractPair pair, ColorProfile colorProfile) {//from w w w. j a va2s . co m if (pair.getPairs().isEmpty()) { return; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glLineWidth(5F); GL11.glBegin(GL11.GL_LINES); for (WorldCoordinate target : pair.getPairs()) { int color = colorProfile.getColor(tile, pair.getCoords(), target); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; GL11.glColor3f(c1, c2, c3); GL11.glVertex3f((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f); float tx = (float) x + target.x - tile.xCoord; float ty = (float) y + target.y - tile.yCoord; float tz = (float) z + target.z - tile.zCoord; GL11.glVertex3f(tx + 0.5f, ty + 0.5f, tz + 0.5f); } GL11.glEnd(); GL11.glPopAttrib(); GL11.glPopMatrix(); }