List of usage examples for org.lwjgl.opengl GL11 glPopAttrib
public static native void glPopAttrib();
From source file:org.agpu.oc.common.tileentity.AdvancedMonitor.java
public void swapBuffers(NBTTagCompound tag) { if (worldObj.isRemote) { for (int i = 0; i < tag.getInteger("commands"); i++) { NBTTagCompound t = tag.getCompoundTag(String.valueOf(i)); String type = t.getString("type"); if (type.equals("startDrawing3D")) { startDrawing3D(t.getInteger("x"), t.getInteger("y"), t.getInteger("width"), t.getInteger("height"), t.getFloat("fov"), t.getFloat("zNear"), t.getFloat("zFar")); } else if (type.equals("startDrawing2D")) { startDrawing2D(t.getInteger("x"), t.getInteger("y"), t.getInteger("width"), t.getInteger("height")); } else if (type.equals("setColor")) { GL11.glColor4f(t.getFloat("r"), t.getFloat("g"), t.getFloat("b"), t.getFloat("a")); } else if (type.equals("vertex3f")) { GL11.glVertex3f(t.getFloat("x"), t.getFloat("y"), t.getFloat("z")); } else if (type.equals("vertex2i")) { GL11.glVertex2i(t.getInteger("x"), t.getInteger("y")); } else if (type.equals("translate")) { GL11.glTranslatef(t.getFloat("x"), t.getFloat("y"), t.getFloat("z")); } else if (type.equals("rotate")) { GL11.glRotatef(t.getFloat("angle"), t.getFloat("x"), t.getFloat("y"), t.getFloat("z")); } else if (type.equals("scale")) { GL11.glScalef(t.getFloat("x"), t.getFloat("y"), t.getFloat("z")); } else if (type.equals("begin")) { GL11.glBegin(t.getInteger("m")); } else if (type.equals("end")) { GL11.glEnd();// ww w . j a v a2s . c om } else if (type.equals("string")) { Minecraft.getMinecraft().fontRendererObj.drawString(t.getString("string"), t.getInteger("x"), t.getInteger("y"), t.getInteger("color")); } else if (type.equals("enable")) { GL11.glEnable(t.getInteger("v")); } else if (type.equals("disable")) { GL11.glDisable(t.getInteger("v")); } else { System.out.println("Unknown packet type received: " + type); } } GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glPopAttrib(); } }
From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java
License:Open Source License
public void popAllAttribs() { GL11.glPopAttrib(); }
From source file:org.geekygoblin.nedetlesmaki.game.systems.DrawSystem.java
License:Open Source License
@Override protected void processEntities(ImmutableBag<Entity> entities) { GL11.glClearColor(99f / 255f, 201f / 255f, 183f / 255f, 1f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); Sort.instance().sort(sprites, zComparator); 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.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();// w w w . ja v a2s.co m GL11.glLoadIdentity(); updateViewPort(); GL11.glViewport(viewPort.x, viewPort.y, viewPort.width, viewPort.height); GLU.gluOrtho2D(-VirtualResolution.WIDTH / 2.0f, VirtualResolution.WIDTH / 2.0f, VirtualResolution.HEIGHT / 2.0f, -VirtualResolution.HEIGHT / 2.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_TEXTURE_2D); 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); NedGame game = (NedGame) world; Entity ned = game.getNed(); if (null != ned) { Sprite nedSprite = spriteMapper.get(ned); Vector nedPos = spriteProjector.project(nedSprite.getPosition()); GL11.glTranslatef(-nedPos.x, -nedPos.y, 0.0f); } for (Entity e : backgrounds) { LevelBackground level = levelBackgroundMapper.getSafe(e); if (null != level) { drawLevel(level); } } GL11.glPushMatrix(); GL11.glScalef(spriteGlobalScale, spriteGlobalScale, 1.0f); spriteBatcher.begin(); for (Entity e : sprites) { spriteBatcher.draw(spriteMapper.getSafe(e)); } spriteBatcher.end(); for (Entity e : sprites) { drawSpriteLabel(spriteMapper.getSafe(e)); } GL11.glPopMatrix(); for (Entity e : uis) { MainMenu mainMenu = mainMenuMapper.getSafe(e); if (null != mainMenu) { nuitRenderer.render(mainMenu.getRoot()); } DialogComponent dialog = dialogMapper.getSafe(e); if (null != dialog) { nuitRenderer.render(dialog.getRoot()); } InGameUI inGameUI = inGameUIMapper.getSafe(e); if (null != inGameUI) { nuitRenderer.render(inGameUI.getRoot()); } } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:org.jogamp.glg2d.impl.gl2.FastLineVisitor.java
License:Apache License
@Override public void endPoly() { drawLine(false); GL11.glDisable(GL11.GL_LINE_STIPPLE); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:org.spoutcraft.api.gui.renderer.GuiRendererFBO.java
License:MIT License
@Override public void drawScreen(Gui gui, RootContainer root, int mouseX, int mouseY, float partialTick) { GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo); GL11.glClearColor(0, 0, 0, 0F);/*from w w w . ja v a 2 s. c om*/ GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_STENCIL_TEST); root.render(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); TextureUtil.bind(guiTex); GL11.glDisable(GL11.GL_BLEND); Tessellator tes = Tessellator.instance; tes.startDrawingQuads(); tes.addVertexWithUV(0, 0, 0, 0, 1); tes.addVertexWithUV(0, gui.height, 0, 0, 0); tes.addVertexWithUV(gui.width, gui.height, 0, 1, 0); tes.addVertexWithUV(gui.width, 0, 0, 1, 1); tes.draw(); GL11.glEnable(GL11.GL_BLEND); GL11.glPopAttrib(); }
From source file:org.yogpstop.qp.client.RenderRefinery.java
License:Open Source License
private void render(TileRefinery tile, double x, double y, double z) { FluidStack liquid1 = null, liquid2 = null, liquidResult = null; float anim = 0; int angle = 0; ModelRenderer theMagnet = this.magnet[0]; if (tile != null) { liquid1 = tile.src1;//from w ww . ja v a 2 s. c om liquid2 = tile.src2; liquidResult = tile.res; anim = tile.getAnimationStage(); angle = 0; switch (tile.worldObj.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); } GL11.glPushMatrix(); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F); theMagnet.render(pixel); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F); theMagnet.render(pixel); GL11.glPopMatrix(); 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); if (liquid1 != null && liquid1.amount > 0) { int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.worldObj, false); if (list1 != null) { bindTexture(FluidRenderer.getFluidSheet(liquid1)); FluidRenderer.setColorForFluidStack(liquid1); GL11.glCallList( list1[(int) (liquid1.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]); } } if (liquid2 != null && liquid2.amount > 0) { int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.worldObj, false); if (list2 != null) { GL11.glPushMatrix(); GL11.glTranslatef(0, 0, 1); bindTexture(FluidRenderer.getFluidSheet(liquid2)); FluidRenderer.setColorForFluidStack(liquid2); GL11.glCallList( list2[(int) (liquid2.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopMatrix(); } } if (liquidResult != null && liquidResult.amount > 0) { int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.worldObj, false); if (list3 != null) { GL11.glPushMatrix(); GL11.glTranslatef(1, 0, 0.5F); bindTexture(FluidRenderer.getFluidSheet(liquidResult)); FluidRenderer.setColorForFluidStack(liquidResult); GL11.glCallList(list3[(int) (liquidResult.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopMatrix(); } } GL11.glPopAttrib(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:render.ui.TWLStateBasedGame.java
License:Open Source License
protected void initGUI() throws SlickException { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); try {/* ww w.j av a 2 s . c om*/ Renderer renderer = new LWJGLRenderer(); ThemeManager theme = loadTheme(renderer); gui = new GUI(emptyRootWidget, renderer, null); gui.applyTheme(theme); Input input = getContainer().getInput(); TWLInputForwarder inputForwarder = new TWLInputForwarder(gui, input); input.addPrimaryListener(inputForwarder); } catch (Throwable e) { throw new SlickException("Could not initialize TWL GUI", e); } finally { GL11.glPopAttrib(); } }
From source file:se37.triangulum.particles.ParticleRenderDispatcher.java
License:Creative Commons License
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { Tessellator tessellator = Tessellator.getInstance(); Profiler profiler = Minecraft.getMinecraft().mcProfiler; GL11.glPushAttrib(GL11.GL_LIGHTING); GlStateManager.depthMask(false);//from www .java 2 s . co m GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F); GlStateManager.disableLighting(); profiler.startSection("psi-particles"); profiler.startSection("sparkle"); FXSparkle.dispatchQueuedRenders(tessellator); profiler.endStartSection("wisp"); FXWisp.dispatchQueuedRenders(tessellator); profiler.endSection(); profiler.endSection(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.depthMask(true); GL11.glPopAttrib(); }
From source file:shadowmage.ancient_framework.client.gui.elements.GuiTextBox.java
License:Open Source License
public void drawTextBox(FontRenderer fontRenderer, int xPos, int yPos) { GL11.glPushMatrix();//from w ww . ja v a2 s .co m GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); drawRect(xPos - 1, yPos - 1, xPos + this.xSize + 1, yPos + this.ySize + 1, -6250336); drawRect(xPos, yPos, xPos + this.xSize, yPos + this.ySize, -16777216); if (this.lines == null) { return; } if (this.dirty) { this.updateScreenChars(); } for (int y = 0; y < this.screenChars.length; y++) { for (int x = 0; x < this.screenChars[y].length; x++) { this.renderCharAt(fontRenderer, xPos + border + charWidth * x, yPos + border + charHeight * y, this.screenChars[y][x]); } } this.renderCursor(fontRenderer, xPos + border + charWidth * cursorPosX, yPos + border + charHeight * cursorPosY + 1); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glPopAttrib() { GL11.glPopAttrib(); }