List of usage examples for org.lwjgl.opengl GL11 glPushAttrib
public static native void glPushAttrib(@NativeType("GLbitfield") int mask);
From source file:me.undergroundminer3.uee4.pipesModded.AdvPipeRenderer.java
License:Minecraft Mod Public
@Deprecated //please copy this instead public void renderPower(Pipe<PipeTransportPower> pipe, double x, double y, double z) { initializeDisplayPowerList(pipe.container.getWorldObj()); PipeTransportPower pow = pipe.transport; GL11.glPushMatrix();//w w w . j a v a 2s . c om GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_BLEND); GL11.glTranslatef((float) x, (float) y, (float) z); bindTexture(TextureMap.locationBlocksTexture); int[] displayList = pow.overload > 0 ? displayPowerListOverload : displayPowerList; for (int side = 0; side < 6; ++side) { GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(angleY[side], 0, 1, 0); GL11.glRotatef(angleZ[side], 0, 0, 1); float scale = 1.0F - side * 0.0001F; GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); short stage = pow.clientDisplayPower[side]; if (stage >= 1) { if (stage < displayList.length) { GL11.glCallList(displayList[stage]); } else { GL11.glCallList(displayList[displayList.length - 1]); } } GL11.glPopMatrix(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:me.undergroundminer3.uee4.pipesModded.AdvPipeRenderer.java
License:Minecraft Mod Public
@Deprecated //please copy this instead public void renderFluids(Pipe<PipeTransportFluids> pipe, double x, double y, double z) { PipeTransportFluids trans = pipe.transport; boolean needsRender = false; for (int i = 0; i < 7; ++i) { FluidStack fluidStack = trans.renderCache[i]; if (fluidStack != null && fluidStack.amount > 0) { needsRender = true;/* www . j a v a 2 s . c om*/ break; } } if (!needsRender) 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); GL11.glTranslatef((float) x, (float) y, (float) z); // sides boolean sides = false, above = false; for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { int i = side.ordinal(); FluidStack fluidStack = trans.renderCache[i]; if (fluidStack == null || fluidStack.amount <= 0) continue; if (!pipe.container.isPipeConnected(side)) continue; DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj()); if (d == null) continue; int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); GL11.glPushMatrix(); int list = 0; switch (ForgeDirection.VALID_DIRECTIONS[i]) { case UP: above = true; list = d.sideVertical[stage]; break; case DOWN: GL11.glTranslatef(0, -0.75F, 0); list = d.sideVertical[stage]; break; case EAST: case WEST: case SOUTH: case NORTH: sides = true; // Yes, this is kind of ugly, but was easier than transform the coordinates above. GL11.glTranslatef(0.5F, 0.0F, 0.5F); GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); GL11.glTranslatef(-0.5F, 0.0F, -0.5F); list = d.sideHorizontal[stage]; break; default: } bindTexture(TextureMap.locationBlocksTexture); RenderUtils.setGLColorFromInt(trans.colorRenderCache[i]); GL11.glCallList(list); GL11.glPopMatrix(); } // CENTER FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()]; if (fluidStack != null && fluidStack.amount > 0) { DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj()); if (d != null) { int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); bindTexture(TextureMap.locationBlocksTexture); RenderUtils.setGLColorFromInt(trans.colorRenderCache[ForgeDirection.UNKNOWN.ordinal()]); if (above) { GL11.glCallList(d.centerVertical[stage]); } if (!above || sides) { GL11.glCallList(d.centerHorizontal[stage]); } } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.gui.GuiTools.java
License:Open Source License
public static void drawVillager(EntityVillager villager, int x, int y, int scale, float yaw, float pitch) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING);// ww w . ja va2 s . c o m GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, 50.0F); GL11.glScalef((float) (-scale), (float) scale, (float) scale); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float) Math.atan((double) (pitch / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); villager.renderYawOffset = (float) Math.atan((double) (yaw / 40.0F)) * 20.0F; villager.rotationYaw = (float) Math.atan((double) (yaw / 40.0F)) * 40.0F; villager.rotationPitch = -((float) Math.atan((double) (pitch / 40.0F))) * 20.0F; villager.rotationYawHead = villager.rotationYaw; GL11.glTranslatef(0.0F, villager.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw(villager, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.carts.CartContentRenderer.java
License:Open Source License
public void render(RenderCart renderer, EntityMinecart cart, float light, float time) { int blockOffset = cart.getDisplayTileOffset(); if (cart instanceof ICartContentsTextureProvider) { ICartContentsTextureProvider texInterface = (ICartContentsTextureProvider) cart; renderer.bindTex(TextureMap.locationBlocksTexture); for (int side = 0; side < 6; side++) { info.texture[side] = texInterface.getBlockTextureOnSide(side); }/*from www.j a va2 s.c om*/ GL11.glPushMatrix(); GL11.glTranslatef(0.0F, (float) blockOffset / 16.0F, 0.0F); RenderFakeBlock.renderBlockOnInventory(renderer.renderBlocks(), info, 1); GL11.glPopMatrix(); return; } Block block = cart.func_145820_n(); if (block != null && block != Blocks.air) { int blockMeta = cart.getDisplayTileData(); renderer.bindTex(TextureMap.locationBlocksTexture); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, (float) blockOffset / 16.0F, 0.0F); renderer.renderBlocks().renderBlockAsItem(block, blockMeta, 1); GL11.glPopMatrix(); return; } ModelTextured contents = CartModelManager.getContentModel(cart.getClass()); if (contents == CartModelManager.emptyModel) return; ResourceLocation texture = contents.getTexture(); if (texture == null) return; renderer.bindTex(texture); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); if (!contents.cullBackFaces()) GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, blockOffset / 16.0F - 0.5F, -0.5F); contents.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.carts.CartContentRendererCargo.java
License:Open Source License
public void renderCargo(RenderCart renderer, EntityCartCargo cart, float light, float time, int x, int y, int z) {//from w w w. j a v a2 s . co m if (!cart.hasFilter()) return; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); EntityItem item = new EntityItem(null, 0.0D, 0.0D, 0.0D, cart.getFilterItem().copy()); item.getEntityItem().stackSize = 1; item.hoverStart = 0.0F; boolean renderIn3D = RenderBlocks .renderItemIn3d(Block.getBlockFromItem(item.getEntityItem().getItem()).getRenderType()); RenderItem.renderInFrame = true; if (!renderIn3D) { if (!RenderManager.instance.options.fancyGraphics) GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef(0.0F, -0.44F, 0.0F); float scale = 1.5F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(90.F, 0.0F, 1.0F, 0.0F); int numIterations = cart.getSlotsFilled(); rand.setSeed(738); for (int i = 0; i < numIterations; i++) { GL11.glPushMatrix(); float tx = (float) rand.nextGaussian() * 0.1F; float ty = (float) rand.nextGaussian() * 0.01F; float tz = (float) rand.nextGaussian() * 0.2F; GL11.glTranslatef(tx, ty, tz); renderEntityItem(item); GL11.glPopMatrix(); } } else { GL11.glTranslatef(-0.08F, -0.44F, -0.18F); float scale = 1.8F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(90.F, 0.0F, 1.0F, 0.0F); int slotsFilled = cart.getSlotsFilled(); int numIterations; if (slotsFilled <= 0) { numIterations = 0; } else { numIterations = (int) Math.ceil(slotsFilled / 3.2); numIterations = MathHelper.clamp_int(numIterations, 1, 5); } rand.setSeed(1983); for (int i = 0; i < numIterations; i++) { GL11.glPushMatrix(); float tx = (float) rand.nextGaussian() * 0.2F; float ty = (float) rand.nextGaussian() * 0.06F; float tz = (float) rand.nextGaussian() * 0.15F; GL11.glTranslatef(tx, ty, tz); renderEntityItem(item); GL11.glPopMatrix(); } } RenderItem.renderInFrame = false; GL11.glPopAttrib(); GL11.glPopMatrix(); }
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. ja v a 2s .c om 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 a2 s. c om 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
private void renderTank(RenderCart renderer, EntityMinecart cart, float light, float time, int x, int y, int z) {// w ww.ja v a 2s . c om EntityCartTank cartTank = (EntityCartTank) cart; StandardTank tank = cartTank.getTankManager().get(0); if (tank.renderData.fluid != null && tank.renderData.amount > 0) { int[] displayLists = FluidRenderer.getLiquidDisplayLists(tank.renderData.fluid); if (displayLists != null) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glTranslatef(0, 0.0625f, 0); float cap = tank.getCapacity(); float level = Math.min(tank.renderData.amount, cap) / cap; renderer.bindTex(FluidRenderer.getFluidSheet(tank.renderData.fluid)); FluidRenderer.setColorForTank(tank); GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]); if (cartTank.isFilling()) { ResourceLocation texSheet = FluidRenderer.setupFlowingLiquidTexture(tank.renderData.fluid, fillBlock.texture); if (texSheet != null) { renderer.bindTex(texSheet); RenderFakeBlock.renderBlockForEntity(fillBlock, 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
private void renderFilterItem(RenderCart renderer, EntityCartTank cart, float light, float time, int x, int y, int z) {//from www . j a v a 2 s . c o m if (!cart.hasFilter()) return; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_CULL_FACE); EntityItem item = new EntityItem(null, 0.0D, 0.0D, 0.0D, cart.getFilterItem().copy()); item.getEntityItem().stackSize = 1; item.hoverStart = 0.0F; float scale = 1.2F; GL11.glPushMatrix(); GL11.glRotatef(90.F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(0.0F, -0.6F, 0.68F); GL11.glScalef(scale, scale, scale); renderItem(item); GL11.glPopMatrix(); GL11.glRotatef(-90.F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(0.0F, -0.6F, 0.68F); GL11.glScalef(scale, scale, scale); renderItem(item); 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 w w w . j ava2 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)); renderTank(renderer, cart, light, time, x, y, z); EntityCartTank cartTank = (EntityCartTank) cart; renderFilterItem(renderer, cartTank, light, time, x, y, z); GL11.glPopAttrib(); GL11.glPopMatrix(); }