List of usage examples for org.lwjgl.opengl GL11 glPopAttrib
public static native void glPopAttrib();
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
public void refresh() { if (mShowOverdraw) { GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT); GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf); GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR); }//from w ww. j a v a2 s . co m // Do the actual paint. doPaint(); if (mShowOverdraw) { GL11.glPopAttrib(); } }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawHierarchy(Node node) { if (node == null || node.bounds.width == 0 || node.bounds.height == 0 || !node.isShowing() || !node.isVisible()) {//from w ww.ja v a2 s .c om return; } // Give a 3d depth. GL11.glPushMatrix(); final float depth = node.depth * mDepth; // Node's translation. GL11.glTranslatef(node.bounds.x, -node.bounds.y, depth); final Drawable background = node.getBackground(); final Drawable content = node.getContent(); final boolean hasBackground = node.isBackgroundShown && (background.displayListId != -1); final boolean hasContent = node.isContentShown && (content.displayListId != -1); if (mIsPicking) { GL11.glColor4f(node.pickColor[0], node.pickColor[1], node.pickColor[2], node.pickColor[3]); drawFrontFace(node, 0.0f, GL11.GL_FILL); // Draw the depth, only if we show in actual mode. // If not, if we are splitting content, draw a layer for it. if (mShowDepth) { drawDepth(node, -mDepth, GL11.GL_FILL); } else if (mSplitContent && hasBackground && hasContent) { drawFrontFace(node, -mDepth / 2.0f, GL11.GL_FILL); } } else { if (!mIsOrtho && mShowDepth) { GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); drawDepthCube(node, depth); GL11.glPopAttrib(); } if (hasBackground && hasContent) { // Both background and content are available. // Draw background at a depth if needed. if (mSplitContent) GL11.glTranslatef(0.0f, 0.0f, -mDepth / 2.0f); GL11.glCallList(background.displayListId); if (mSplitContent) GL11.glTranslatef(0.0f, 0.0f, mDepth / 2.0f); GL11.glCallList(content.displayListId); } else if (hasBackground) { GL11.glCallList(background.displayListId); } else if (hasContent) { GL11.glCallList(content.displayListId); } // Stencil shouldn't know about bounds. GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT | GL11.GL_LINE_BIT); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); // Show bounds. if (!mIsOrtho && mShowDepth) { loadColor(ColorType.BOUNDS_NORMAL); } else { if (node.isSelected) { GL11.glLineWidth(2.0f); loadColor(ColorType.BOUNDS_SELECTION); } else { loadColor(ColorType.BOUNDS_NORMAL); } } if (node.isSelected || !mIsOrtho || mShowBounds) { drawFrontFace(node, 0.0f, GL11.GL_LINE); } // Show a bounding box for split content in perspective mode. if (!mIsOrtho && !mShowDepth && mSplitContent && hasBackground && hasContent) { drawFrontFace(node, -mDepth / 2.0f, GL11.GL_LINE); } GL11.glPopAttrib(); } for (Node child : node.children) { drawHierarchy(child); } GL11.glPopMatrix(); }
From source file:com.telinc1.rpjg.module.Module.java
License:Apache License
/** * Renders the module's graphics and UI elements. * Also applied the screen darkening effect for modal modules.<br /> * Generally not a good idea to override this. *///from ww w . jav a2s. c om public void render() { if (this.isModal()) { DrawingUtils.unbindTextures(); // Not going to change this to use DrawingUtils until // I don't make actual modal modules. // Don't want untested code! GL11.glPushAttrib(DrawingUtils.GL_COLOR_BITS); GL11.glColor4f(0f, 0f, 0f, .5f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(0, 0); GL11.glVertex2i(Display.getWidth(), 0); GL11.glVertex2i(Display.getWidth(), Display.getHeight()); GL11.glVertex2i(0, Display.getHeight()); GL11.glEnd(); GL11.glPopAttrib(); } this.renderGraphics(); this.renderUI(); for (Gui gui : this.getGUIs()) { gui.render(); } }
From source file:com.wuest.prefab.Structures.Render.StructureRenderHandler.java
License:Open Source License
/** * This is to render the currently bound structure. * @param player The player to render the structure for. * @param src The ray trace for where the player is currently looking. *//*w w w . j a v a2s . com*/ public static void renderPlayerLook(EntityPlayer player, RayTraceResult src) { if (StructureRenderHandler.currentStructure != null && StructureRenderHandler.dimension == player.world.provider.getDimension() && StructureRenderHandler.currentConfiguration != null && Prefab.proxy.proxyConfiguration.enableStructurePreview) { GlStateManager.pushMatrix(); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableLighting(); rendering = true; boolean didAny = false; // Use a unique shader for these blocks so the player can tell them apart from the rest of the world. ShaderHelper.useShader(ShaderHelper.alphaShader); for (BuildBlock buildBlock : StructureRenderHandler.currentStructure.getBlocks()) { Block foundBlock = Block.REGISTRY.getObject(buildBlock.getResourceLocation()); if (foundBlock != null) { // Get the unique block state for this block. IBlockState blockState = foundBlock.getDefaultState(); buildBlock = BuildBlock.SetBlockState(StructureRenderHandler.currentConfiguration, player.world, StructureRenderHandler.currentConfiguration.pos, StructureRenderHandler.assumedNorth, buildBlock, foundBlock, blockState, StructureRenderHandler.currentStructure); if (StructureRenderHandler.renderComponentInWorld(player.world, buildBlock)) { didAny = true; } } } // Release the shader so the whole world isn't using this shader. ShaderHelper.releaseShader(); rendering = false; GL11.glPopAttrib(); GlStateManager.popMatrix(); if (!didAny) { // Nothing was generated, tell the user this through a chat message and re-set the structure information. StructureRenderHandler.setStructure(null, EnumFacing.NORTH, null); player.sendMessage(new TextComponentTranslation(GuiLangKeys.GUI_PREVIEW_COMPLETE) .setStyle(new Style().setColor(TextFormatting.GREEN))); } else if (!StructureRenderHandler.showedMessage) { player.sendMessage(new TextComponentTranslation(GuiLangKeys.GUI_PREVIEW_NOTICE) .setStyle(new Style().setColor(TextFormatting.GREEN))); StructureRenderHandler.showedMessage = true; } } }
From source file:com.yogpc.qp.client.RenderRefinery.java
License:Open Source License
private void render(final TileRefinery tile, final double x, final double y, final double z) { float anim = 0; int angle = 0; ModelRenderer theMagnet = this.magnet[0]; if (tile != null) { anim = tile.getAnimationStage(); angle = 0;//w w w . j ava 2 s . c o m 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 = this.magnet[0]; else if (tile.animationSpeed <= 2.5) theMagnet = this.magnet[1]; else if (tile.animationSpeed <= 4.5) theMagnet = this.magnet[2]; else theMagnet = this.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); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, 4F * pixel); GL11.glTranslatef(-4F * pixel, 0, 4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, -4F * pixel); GL11.glTranslatef(4F * pixel, 0, 0); this.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; } renderMagnet(trans1, theMagnet, 0); renderMagnet(trans2, theMagnet, 12 * pixel); 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); renderFluid(tile.src[0], 0, 0, 0, tile.buf); renderFluid(tile.src[1], 0, 0, 1, tile.buf); renderFluid(tile.res, 1, 0, 0.5F, tile.buf); GL11.glPopAttrib(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:de.johni0702.minecraft.gui.OffsetGuiRenderer.java
License:MIT License
public void stopUsing() { GL11.glPopAttrib(); }
From source file:dynamicswordskills.client.GuiSkills.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { if (needsScrollBar()) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND);//from w w w . j a v a2 s . c o m mc.renderEngine.bindTexture(texture); RenderHelperQ.drawTexturedRect(259, 55, 282, 0, 3, 5, 285, 180); RenderHelperQ.drawTexturedRect(259, 150, 282, 5, 3, 5, 285, 180); RenderHelperQ.drawTexturedRect(260, 61, 283, 17, 1, 88, 285, 180); RenderHelperQ.drawTexturedRect(259, 61 + (int) (scrollY * 81), 282, 10, 3, 7, 285, 180); GL11.glPopAttrib(); } String s = (currentSkill != null ? currentSkill.getDisplayName().toUpperCase() : StatCollector.translateToLocal("skill.dss.gui.description")); isUnicode = fontRendererObj.getUnicodeFlag(); fontRendererObj.setUnicodeFlag(true); fontRendererObj.drawString(s, 158, 38, 4210752); if (currentSkill != null) { if (Config.isSkillEnabled(currentSkill.getId())) { s = currentSkill.getLevelDisplay(false); } else { s = (EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("skill.dss.disabled")); } fontRendererObj.drawString(s, 262 - fontRendererObj.getStringWidth(s), 38, 4210752); } refreshDescription(); textY = 38 + (fontRendererObj.FONT_HEIGHT * 2); int start = (needsScrollBar() ? (int) (scrollY * (numLines - MAX_LINES)) : 0); for (int i = start; i < desc.size() && i < (MAX_LINES + start); ++i) { fontRendererObj.drawString(desc.get(i), 158, textY, 4210752); textY += fontRendererObj.FONT_HEIGHT; } fontRendererObj.setUnicodeFlag(isUnicode); }
From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManager.java
License:Apache License
protected void renderControl(Control control) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*w ww . j a v a2 s. co m*/ GL11.glLoadIdentity(); control.render(); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:forestry.apiculture.render.BeeItemRenderer.java
License:Open Source License
private void renderBeeItem(IBee bee, float translateX, float translateY, float translateZ) { float yaw = 1; float pitch = 1; GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING);/*from www . ja va2 s . c o m*/ GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glScalef(2.0f, 2.0f, 2.0f); GL11.glTranslatef(translateX, translateY, translateZ); 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(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; entity.rotationYawHead = entity.rotationYaw; RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(bee)); 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:forestry.apiculture.render.BeeItemRenderer.java
License:Open Source License
private void renderBeeInInventory(IBee bee) { /*//from ww w . j a v a 2 s . c o m GL11.glPushMatrix(); //GL11.glTranslatef(-0.3f, -2.5f, 0f); GL11.glScalef(-1.0f, 1.0f, 1.0f); //GL11.glScalef((float)Math.PI / 2, 1.0f, 1.0f); 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) (1 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); renderBeeHalo(); GL11.glPopMatrix(); */ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_COLOR_MATERIAL); RenderHelper.enableStandardItemLighting(); GL11.glPushMatrix(); GL11.glTranslatef(-0.3f, -2.5f, 0f); GL11.glScalef(-3.0f, 3.0f, 3.0f); GL11.glRotatef(32.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.6f, 1f, 1f); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); entity.renderYawOffset = 0; entity.rotationYaw = 0; entity.rotationPitch = 0; entity.rotationYawHead = entity.rotationYaw; RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(bee)); 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(); }