/** Convenience method which assists in rendering portions of the OpenGL texture to the screen, if the application intends to draw them as a flat overlay on to the screen. Pushes OpenGL state bits (GL_ENABLE_BIT, GL_DEPTH_BUFFER_BIT and GL_TRANSFORM_BIT); disables the depth test, back-face culling, and lighting; enables the texture in this renderer; and sets up the viewing matrices for orthographic rendering where the coordinates go from (0, 0) at the lower left to (width, height) at the upper right. Equivalent to beginOrthoRendering(width, height, true). {@link #endOrthoRendering} must be used in conjunction with this method to restore all OpenGL states. @param width the width of the current on-screen OpenGL drawable @param height the height of the current on-screen OpenGL drawable @throws GLException If an OpenGL context is not current when this method is called */ public void beginOrthoRendering(final int width, final int height) throws GLException { beginOrthoRendering(width, height, true); }
/** Begins the OpenGL rendering process for the overlay. This is separated out so advanced applications can render independent pieces of the overlay to different portions of the drawable. @throws GLException If an OpenGL context is not current when this method is called */ public void beginRendering() throws GLException { renderer.beginOrthoRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); }
@Override public void display(final GLAutoDrawable drawable) { final GL2 gl = GLContext.getCurrentGL().getGL2(); gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT); if (packer == null) { return; } final TextureRenderer rend = getBackingStore(); final int w = rend.getWidth(); final int h = rend.getHeight(); rend.beginOrthoRendering(w, h); rend.drawOrthoRect(0, 0); rend.endOrthoRendering(); if ((frame.getWidth() != w) || (frame.getHeight() != h)) { EventQueue.invokeLater(new Runnable() { @Override public void run() { frame.setSize(w, h); } }); } }
((TextureRenderer) newBackingStore).beginOrthoRendering(beginRenderingWidth, beginRenderingHeight, beginRenderingDepthTestDisabled); } else {
getBackingStore().beginOrthoRendering(width, height, disableDepthTestForOrtho); } else {