List of usage examples for org.lwjgl.opengl GL11 glPopAttrib
public static native void glPopAttrib();
From source file:hellfirepvp.astralsorcery.common.item.wand.ItemExchangeWand.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)//from w w w. j ava 2 s. c o m public void onRenderWhileInHand(ItemStack stack, EnumHand hand, float pTicks) { IBlockState stored = getStoredState(stack); ItemStack matchStack = getStoredStateAsStack(stack); if (stored == null || stored.getBlock().equals(Blocks.AIR) || matchStack.isEmpty()) return; EntityPlayer pl = Minecraft.getMinecraft().player; PlayerControllerMP ctrl = Minecraft.getMinecraft().playerController; if (ctrl == null || pl == null) return; RayTraceResult rtr = getLookBlock(pl, false, true, ctrl.getBlockReachDistance()); if (rtr == null) return; IBlockAccess airWorld = new AirBlockRenderWorld(Biomes.PLAINS, Minecraft.getMinecraft().world.getWorldType()); BlockPos origin = rtr.getBlockPos(); IBlockState atOrigin = Minecraft.getMinecraft().world.getBlockState(origin); if (stored.getBlock().equals(atOrigin.getBlock()) && stored.getBlock().getMetaFromState(stored) == atOrigin.getBlock().getMetaFromState(atOrigin)) { return; } int amt = 0; if (pl.isCreative()) { amt = -1; } else { if (Mods.BOTANIA.isPresent()) { amt = ModIntegrationBotania.getItemCount(Minecraft.getMinecraft().player, stack, stored); } else { for (ItemStack st : ItemUtils.findItemsInPlayerInventory(pl, matchStack, false)) { amt += st.getCount(); } } } BlockArray found = BlockDiscoverer.discoverBlocksWithSameStateAround(Minecraft.getMinecraft().world, origin, true, searchDepth, amt, false); if (found.isEmpty()) return; GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); boolean blend = GL11.glGetBoolean(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND); Blending.ADDITIVEDARK.apply(); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST); RenderingUtils.removeStandartTranslationFromTESRMatrix(pTicks); Tessellator tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); for (BlockPos pos : found.getPattern().keySet()) { Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(stored, pos, airWorld, vb); } vb.sortVertexData((float) TileEntityRendererDispatcher.staticPlayerX, (float) TileEntityRendererDispatcher.staticPlayerY, (float) TileEntityRendererDispatcher.staticPlayerZ); tes.draw(); Blending.DEFAULT.apply(); if (!blend) { GL11.glDisable(GL11.GL_BLEND); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void render(Root root) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT); GL11.glViewport(0, 0, LwjglHelper.getWidth(), LwjglHelper.getHeight()); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();// w w w . j a va 2s. com GL11.glLoadIdentity(); GL11.glOrtho(root.getX(), root.getWidth(), root.getHeight(), root.getY(), -1.0, 1.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_TEXTURE_2D); drawBackgroundAndBorder(root); drawStack(root); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:makeo.gadomancy.client.events.RenderEventHandler.java
License:LGPL
@SubscribeEvent public void on(DrawBlockHighlightEvent e) { if (e.currentItem == null) return;// w ww . j a v a 2s . c om if (e.currentItem.getItem() instanceof ItemWandCasting) { ItemFocusBasic focus = ((ItemWandCasting) e.currentItem.getItem()).getFocus(e.currentItem); if (focus == null || !(focus instanceof IArchitect)) { Block block = e.player.worldObj.getBlock(e.target.blockX, e.target.blockY, e.target.blockZ); if (block != null && block == RegisteredBlocks.blockArcaneDropper) { ForgeDirection dir = ForgeDirection.getOrientation( e.player.worldObj.getBlockMetadata(e.target.blockX, e.target.blockY, e.target.blockZ) & 7); ArrayList<BlockCoordinates> coords = new ArrayList<BlockCoordinates>(); for (int x = -1; x < 2; x++) { for (int y = -1; y < 2; y++) { for (int z = -1; z < 2; z++) { coords.add(new BlockCoordinates(e.target.blockX + 2 * dir.offsetX + x, e.target.blockY + 2 * dir.offsetY + y, e.target.blockZ + 2 * dir.offsetZ + z)); } } } coords.add(new BlockCoordinates(e.target.blockX + dir.offsetX, e.target.blockY + dir.offsetY, e.target.blockZ + dir.offsetZ)); ARCHITECT_ITEM.setCoords(coords); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); WAND_HANDLER.handleArchitectOverlay(new ItemStack(ARCHITECT_ITEM), e, e.player.ticksExisted, e.target); GL11.glPopAttrib(); } } } else if (e.currentItem.getItem() instanceof ItemThaumometer) { if (e.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return; int blockX = e.target.blockX; int blockY = e.target.blockY; int blockZ = e.target.blockZ; if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { TileEntity tile = e.player.worldObj.getTileEntity(blockX, blockY, blockZ); if (tile instanceof TileExtendedNode) { TileExtendedNode node = (TileExtendedNode) tile; if (node.getExtendedNodeType() == null) return; ExtendedTypeDisplayManager.notifyDisplayTick(node.getId(), node.getNodeType(), node.getExtendedNodeType()); } else if (tile instanceof TileExtendedNodeJar) { TileExtendedNodeJar nodeJar = (TileExtendedNodeJar) tile; if (nodeJar.getExtendedNodeType() == null) return; ExtendedTypeDisplayManager.notifyDisplayTick(nodeJar.getId(), nodeJar.getNodeType(), nodeJar.getExtendedNodeType()); } } } }
From source file:makeo.gadomancy.client.gui.InfusionClawGui.java
License:LGPL
@Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { ItemStack cursorStack = container.playerInv.getItemStack(); if (((TileInfusionClaw) container.clawInv).isRunning() || (cursorStack != null && cursorStack.stackSize > 0 && !container.clawInv.isItemValidForSlot(0, cursorStack))) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND);//from ww w . j ava 2s .c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 0.5f); this.mc.renderEngine.bindTexture(BACKGROUND); float t = this.zLevel; this.zLevel = 200.0F; GL11.glEnable(3042); drawTexturedModalRect(80, 32, 240, 0, 16, 16); GL11.glDisable(3042); this.zLevel = t; GL11.glPopAttrib(); } }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileRemoteJar.java
License:LGPL
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*from w ww . j av a 2 s . co m*/ GL11.glTranslated(x, y, z); GL11.glPushMatrix(); GL11.glTranslatef(0.45f / 2, 0.003f, 0.45f / 2); GL11.glScalef(0.55f, 1, 0.55f); TileMirrorRenderer renderer = new TileMirrorRenderer(); renderer.func_147497_a(this.field_147501_a); if (field_147501_a.field_147553_e != null) { renderer.renderTileEntityAt(createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), 0, 0, 0, partialTicks); } GL11.glPopMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef(0.5f, 0.002f, 0.5f); GL11.glRotatef(180, 0, 0, 1); bindTexture(OVERLAY_TEXTURE); GL11.glScalef(1.002f, 1f, 1.002f); GL11.glTranslatef(0, -1.5f, 0); //GL11.glRotatef(180, 1f, 0, 0); MODEL_JAR_POT.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f); GL11.glPopMatrix(); GL11.glPopAttrib(); super.renderTileEntityAt(tile, x, y, z, partialTicks); }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileStickyJar.java
License:LGPL
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) { TileStickyJar stickyJar = (TileStickyJar) tile; TileJarFillable parent = stickyJar.getParent(); World world = tile.getWorldObj(); Block block = stickyJar.getParentBlock(); GL11.glPushMatrix();/*from w w w . ja v a 2 s . c o m*/ GL11.glTranslated(x, y, z); rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing)); //TESR TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent); if (renderer != null) { stickyJar.syncToParent(); renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks); stickyJar.syncFromParent(); } //ISimpleBlockHandler GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bindTexture(TextureMap.locationBlocksTexture); RENDER_BLOCKS.blockAccess = world; Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); tess.setNormal(0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX)); tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord); RENDER_BLOCKS.renderBlockByRenderType(block, tile.xCoord, tile.yCoord, tile.zCoord); tess.setTranslation(0, 0, 0); tess.draw(); GL11.glPopAttrib(); GL11.glPopMatrix(); GL11.glPopMatrix(); } }
From source file:matteroverdrive.client.model.MOModelRenderColored.java
License:Open Source License
@SideOnly(Side.CLIENT) public void render(float p_78785_1_) { if (disableLighting) { GL11.glDisable(GL11.GL_LIGHTING); RenderUtils.disableLightmap();/* w ww .j a va 2 s . co m*/ } GL11.glPushAttrib(GL11.GL_CURRENT_BIT); RenderUtils.applyColor(color); super.render(p_78785_1_); GL11.glPopAttrib(); if (disableLighting) { GL11.glEnable(GL11.GL_LIGHTING); RenderUtils.enableLightmap(); } }
From source file:matteroverdrive.gui.GuiStarMap.java
License:Open Source License
public void drawWorldBackground(int p_146270_1_) { glDisable(GL_TEXTURE_2D);/*from ww w. j a va2s . com*/ glColor3f(0, 0, 0); RenderUtils.drawPlane(0, 0, -1000, width, height); glEnable(GL_TEXTURE_2D); glPushMatrix(); //GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); //GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); glPushAttrib(GL_COLOR_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); GL11.glMatrixMode(GL11.GL_PROJECTION); glPushMatrix(); GL11.glLoadIdentity(); Project.gluPerspective(75f, (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05f, 20); //RenderUtil.loadMatrix(camera.getTransposeProjectionMatrix()); GL11.glMatrixMode(GL11.GL_MODELVIEW); glPushMatrix(); GL11.glLoadIdentity(); //RenderUtil.loadMatrix(camera.getTransposeViewMatrix()); glRotated(15, 1, 0, 0); GL11.glTranslatef(0, -0.8f, 0); float lastRotationYaw = Minecraft.getMinecraft().renderViewEntity.rotationYaw; float lastRotationPitch = Minecraft.getMinecraft().renderViewEntity.rotationPitch; float rotation = 0; if (machine.getZoomLevel() <= 2) { rotation = mc.theWorld.getWorldTime() * 0.1f; } Minecraft.getMinecraft().renderViewEntity.rotationYaw = 180 + rotation; Minecraft.getMinecraft().renderViewEntity.prevRotationPitch = Minecraft .getMinecraft().renderViewEntity.rotationPitch = 15; //bindTexture(ClientProxy.renderHandler.getRendererOmniTool().getWeaponTexture()); //ClientProxy.renderHandler.getRendererOmniTool().getModel().renderAll(); switch (machine.getZoomLevel()) { case 0: glTranslated(0, -1.1, -4f); break; case 1: glTranslated(0, -0.6, -4f); break; case 2: Star star = machine.getStar(); float maxDistance = 0; if (star != null) { for (Planet planet : star.getPlanets()) { if (maxDistance < planet.getOrbit()) { maxDistance = planet.getOrbit(); } } } glTranslated(0, 0, -maxDistance * 3 - 1.5f); break; default: GL11.glTranslatef(0, 0.1f, -3f); break; } glRotated(rotation, 0, 1, 0); //glTranslated(0.5f,2.5f,3); ClientProxy.renderHandler.getTileEntityRendererStarMap().render(machine, -0.5f, -1.8f, -0.5f, 0); glPopMatrix(); //fontRendererObj.drawString("Test",100,100,0xffffff); GL11.glMatrixMode(GL11.GL_PROJECTION); glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); glPopMatrix(); Minecraft.getMinecraft().renderViewEntity.rotationYaw = lastRotationYaw; Minecraft.getMinecraft().renderViewEntity.prevRotationPitch = Minecraft .getMinecraft().renderViewEntity.rotationPitch = lastRotationPitch; GL11.glPopAttrib(); }
From source file:me.ukl.api.gui.renderer.GuiRendererDepth.java
License:MIT License
@Override public void drawScreen(Gui gui, RootContainer root, int mouseX, int mouseY, float partialTick) { GL11.glEnable(GL11.GL_BLEND);//from www . jav a2s .co m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushAttrib(GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(0, 0, 1); root.render(); //Clip setup by root! GL11.glPopAttrib(); }
From source file:me.undergroundminer3.uee4.pipesModded.AdvPipeRenderer.java
License:Minecraft Mod Public
@Deprecated //please copy this instead public void pipeWireRender(TileGenericPipe pipe, float cx, float cy, float cz, PipeWire color, double x, double y, double z) { PipeRenderState state = pipe.renderState; float minX = CoreConstants.PIPE_MIN_POS; float minY = CoreConstants.PIPE_MIN_POS; float minZ = CoreConstants.PIPE_MIN_POS; float maxX = CoreConstants.PIPE_MAX_POS; float maxY = CoreConstants.PIPE_MAX_POS; float maxZ = CoreConstants.PIPE_MAX_POS; boolean foundX = false, foundY = false, foundZ = false; if (state.wireMatrix.isWireConnected(color, ForgeDirection.WEST)) { minX = 0;//from w w w . j a va2 s . c o m foundX = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.EAST)) { maxX = 1; foundX = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.DOWN)) { minY = 0; foundY = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.UP)) { maxY = 1; foundY = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.NORTH)) { minZ = 0; foundZ = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.SOUTH)) { maxZ = 1; foundZ = true; } boolean center = false; if (minX == 0 && maxX != 1 && (foundY || foundZ)) if (cx == CoreConstants.PIPE_MIN_POS) { maxX = CoreConstants.PIPE_MIN_POS; } else { center = true; } if (minX != 0 && maxX == 1 && (foundY || foundZ)) if (cx == CoreConstants.PIPE_MAX_POS) { minX = CoreConstants.PIPE_MAX_POS; } else { center = true; } if (minY == 0 && maxY != 1 && (foundX || foundZ)) if (cy == CoreConstants.PIPE_MIN_POS) { maxY = CoreConstants.PIPE_MIN_POS; } else { center = true; } if (minY != 0 && maxY == 1 && (foundX || foundZ)) if (cy == CoreConstants.PIPE_MAX_POS) { minY = CoreConstants.PIPE_MAX_POS; } else { center = true; } if (minZ == 0 && maxZ != 1 && (foundX || foundY)) if (cz == CoreConstants.PIPE_MIN_POS) { maxZ = CoreConstants.PIPE_MIN_POS; } else { center = true; } if (minZ != 0 && maxZ == 1 && (foundX || foundY)) if (cz == CoreConstants.PIPE_MAX_POS) { minZ = CoreConstants.PIPE_MAX_POS; } else { center = true; } boolean found = foundX || foundY || foundZ; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); RenderHelper.disableStandardItemLighting(); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); float scale = 1.001f; GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); bindTexture(TextureMap.locationBlocksTexture); RenderInfo box = new RenderInfo(); box.texture = BuildCraftTransport.instance.wireIconProvider .getIcon(state.wireMatrix.getWireIconIndex(color)); // Z render if (minZ != CoreConstants.PIPE_MIN_POS || maxZ != CoreConstants.PIPE_MAX_POS || !found) { box.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, minZ, cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, maxZ); RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } // X render if (minX != CoreConstants.PIPE_MIN_POS || maxX != CoreConstants.PIPE_MAX_POS || !found) { box.setBounds(minX, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, maxX, cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F); RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } // Y render if (minY != CoreConstants.PIPE_MIN_POS || maxY != CoreConstants.PIPE_MAX_POS || !found) { box.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, minY, cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, maxY, cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F); RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } if (center || !found) { box.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F); RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } RenderHelper.enableStandardItemLighting(); GL11.glPopAttrib(); GL11.glPopMatrix(); }