From 91d3bf4ea69046684540402cb1fd46e70682a6c5 Mon Sep 17 00:00:00 2001 From: Rami Santina Date: Tue, 9 Aug 2011 20:51:12 +0300 Subject: GLRunnable API Change: Return boolean indicating whether the back buffer shall be updated before swap. This allows color selection GLRunnables, executed after the GLEventListener. --- .../opengl/test/junit/graph/demos/GPURendererListenerBase01.java | 8 +++++--- .../opengl/test/junit/graph/demos/ui/UIListenerBase01.java | 8 +++++--- .../jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java | 6 ++++-- .../jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java | 9 ++------- 4 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index a837c56f8..7a10c4950 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -254,7 +254,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { else if(arg0.getKeyCode() == KeyEvent.VK_V) { if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { GL gl = drawable.getGL(); int i = gl.getSwapInterval(); i = i==0 ? 1 : 0; @@ -267,6 +267,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { ((FPSCounter)drawable).resetFPSCounter(); } System.err.println("Swap Interval: "+i); + return true; } }); } @@ -275,7 +276,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { rotate(-1); if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { try { final String type = Region.isVBAA(renderModes) ? "vbaa0-msaa1" : "vbaa1-msaa0" + ( Region.isNonUniformWeight(renderModes) ? "-vc" : "-uc" ) ; printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); @@ -284,7 +285,8 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); - } + } + return true; } }); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index b89f87be4..0fe48e550 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -281,7 +281,7 @@ public abstract class UIListenerBase01 implements GLEventListener { else if(arg0.getKeyCode() == KeyEvent.VK_V) { if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { GL gl = drawable.getGL(); int i = gl.getSwapInterval(); i = i==0 ? 1 : 0; @@ -291,6 +291,7 @@ public abstract class UIListenerBase01 implements GLEventListener { a.resetFPSCounter(); } System.err.println("Swap Interval: "+i); + return true; } }); } @@ -299,7 +300,7 @@ public abstract class UIListenerBase01 implements GLEventListener { rotate(-1); if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { try { final String type = ( 1 == rRenderer.getRenderModes() ) ? "r2t0-msaa1" : "r2t1-msaa0" ; printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); @@ -308,7 +309,8 @@ public abstract class UIListenerBase01 implements GLEventListener { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); - } + } + return true; } }); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java index 9a6548dd4..afddb5676 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java @@ -92,11 +92,12 @@ public class TestGLDebug01NEWT extends UITestCase { Assert.assertEquals((null == glDebugExt) ? false : enable, ctx.isGLDebugMessageEnabled()); if(ctx.isGLDebugMessageEnabled() && null != dbgTstMsg && 0 <= dbgTstId) { window.invoke(true, new GLRunnable() { - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { drawable.getContext().glDebugMessageInsert(GL2GL3.GL_DEBUG_SOURCE_APPLICATION_ARB, GL2GL3.GL_DEBUG_TYPE_OTHER_ARB, dbgTstId, GL2GL3.GL_DEBUG_SEVERITY_MEDIUM_ARB, dbgTstMsg); + return true; } }); Assert.assertEquals(true, myGLDebugListener.received()); @@ -128,8 +129,9 @@ public class TestGLDebug01NEWT extends UITestCase { window.getContext().addGLDebugListener(myGLDebugListener); window.invoke(true, new GLRunnable() { - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { drawable.getGL().glBindFramebuffer(-1, -1); // ERROR ! + return true; } } ); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java index 620219dc7..1ca74774b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java @@ -28,12 +28,6 @@ package com.jogamp.opengl.test.junit.newt.parenting; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.AfterClass; -import org.junit.Test; - import javax.media.opengl.*; public class GLRunnableDummy implements GLRunnable { @@ -42,7 +36,7 @@ public class GLRunnableDummy implements GLRunnable { float b=0.0f; float d=0.1f; - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glClearColor(r, g, b, 1f); r+=d; @@ -53,5 +47,6 @@ public class GLRunnableDummy implements GLRunnable { r=0f; d*=-1f; } + return true; } } -- cgit v1.2.3