diff options
author | Sven Gothel <[email protected]> | 2009-10-04 00:19:32 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-04 00:19:32 -0700 |
commit | 4b9a72c24bb97ed81c79c3931d4ffb5fa53d9978 (patch) | |
tree | 0237b562f04fbe56fe0245dbbefecfc6c608caee /src/demos/es1/cube | |
parent | 30c1fe267c0cf47a25db06ac93c6065881af2a20 (diff) |
Add ReadBuffer Demos/ModuleTests; Incl. SurfaceUpdated Listener, ReadPixel to file, texture - direct or via attaching the drawable to another context as it's readbuffer
Diffstat (limited to 'src/demos/es1/cube')
-rw-r--r-- | src/demos/es1/cube/Cube.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index d9c00b2..d46f41b 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -43,6 +43,8 @@ import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; public class Cube implements GLEventListener { + public boolean glDebug = false ; + public boolean glTrace = false ; boolean quit = false; public Cube () { @@ -77,7 +79,23 @@ public class Cube implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + GL _gl = drawable.getGL(); + + _gl.glGetError(); // flush error .. + + if(glDebug) { + try { + _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); + } catch (Exception e) {e.printStackTrace();} + } + + if(glTrace) { + try { + _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); + } catch (Exception e) {e.printStackTrace();} + } + + GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(_gl); glu = GLU.createGLU(); @@ -179,9 +197,15 @@ public class Cube implements GLEventListener { } public void display(GLAutoDrawable drawable) { + display(drawable, true); + } + + public void display(GLAutoDrawable drawable, boolean clear) { GL2ES1 gl = drawable.getGL().getGL2ES1(); - gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); + if(clear) { + gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); + } gl.glMatrixMode(gl.GL_MODELVIEW); gl.glLoadIdentity(); |