aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-20 22:46:53 +0200
committerSven Gothel <[email protected]>2012-09-20 22:46:53 +0200
commit0f531ec116245b10fcb41e7b0905f240b91aa93a (patch)
treee0f699c4fda668426310c9257c12b8cd8aec547f
parent60c63acc298fd33ada43f37962d1d6c32a0359c3 (diff)
FBO tests: Add singleBuffer cmd-line option for offscreen-layered tests; FBOMRT: Allow test w/ only one attachment number (sure not MRT then)
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java17
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java6
3 files changed, 24 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java
index 077baad43..8e2468536 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java
@@ -50,7 +50,6 @@ import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLPipelineFactory;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
@@ -74,7 +73,7 @@ public class TestFBOMRTNEWT01 extends UITestCase {
new GLCapabilities(GLProfile.getGL2GL3()), width/step, height/step, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
GL2GL3 gl = winctx.context.getGL().getGL2GL3();
- gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2GL3();
+ // gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2GL3();
System.err.println(winctx.context);
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
@@ -162,7 +161,13 @@ public class TestFBOMRTNEWT01 extends UITestCase {
final FBObject fbo_mrt = new FBObject();
fbo_mrt.reset(gl, drawable.getWidth(), drawable.getHeight());
final TextureAttachment texA0 = fbo_mrt.attachTexture2D(gl, texA0Point, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
- final TextureAttachment texA1 = fbo_mrt.attachTexture2D(gl, texA1Point, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
+ final TextureAttachment texA1;
+ if(fbo_mrt.getMaxColorAttachments() > 1) {
+ texA1 = fbo_mrt.attachTexture2D(gl, texA1Point, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
+ } else {
+ texA1 = null;
+ System.err.println("FBO supports only one attachment, no MRT available!");
+ }
fbo_mrt.attachRenderbuffer(gl, Type.DEPTH, 24);
Assert.assertTrue( fbo_mrt.isStatusValid() ) ;
fbo_mrt.unbind(gl);
@@ -216,8 +221,10 @@ public class TestFBOMRTNEWT01 extends UITestCase {
gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
fbo_mrt.use(gl, texA0);
- gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit1.intValue());
- fbo_mrt.use(gl, texA1);
+ if(null != texA1) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit1.intValue());
+ fbo_mrt.use(gl, texA1);
+ }
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
fbo_mrt.unuse(gl);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
index 3c9afbd2f..b9e3f0606 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
@@ -59,6 +59,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
+ static boolean singleBuffer = false;
static boolean useMSAA = false;
static boolean addComp = true;
static int swapInterval = 1;
@@ -137,6 +138,9 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
final Frame frame1 = new Frame("AWT Parent Frame");
GLCapabilities caps = new GLCapabilities(null);
+ if(singleBuffer) {
+ caps.setDoubleBuffered(false);
+ }
if(useMSAA) {
caps.setNumSamples(4);
caps.setSampleBuffers(true);
@@ -216,6 +220,8 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
shallUseOffscreenPBufferLayer = true;
} else if(args[i].equals("-msaa")) {
useMSAA = true;
+ } else if(args[i].equals("-single")) {
+ singleBuffer = true;
} else if(args[i].equals("-still")) {
noAnimation = true;
} else if(args[i].equals("-wait")) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
index ef7541d3f..ce90c77c5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
@@ -59,6 +59,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
+ static boolean singleBuffer = false;
static boolean useMSAA = false;
static boolean addComp = true;
static int swapInterval = 1;
@@ -129,6 +130,9 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
final Frame frame1 = new Frame("AWT Parent Frame");
GLCapabilities caps = new GLCapabilities(null);
+ if(singleBuffer) {
+ caps.setDoubleBuffered(false);
+ }
if(useMSAA) {
caps.setNumSamples(4);
caps.setSampleBuffers(true);
@@ -213,6 +217,8 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
shallUseOffscreenPBufferLayer = true;
} else if(args[i].equals("-msaa")) {
useMSAA = true;
+ } else if(args[i].equals("-single")) {
+ singleBuffer = true;
} else if(args[i].equals("-still")) {
noAnimation = true;
} else if(args[i].equals("-wait")) {