aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-20 02:51:44 +0200
committerSven Gothel <[email protected]>2014-09-20 02:51:44 +0200
commit711757aa4e087d97c3103489c47fbd7d76bcac3d (patch)
tree89c0b2b8cfc49aa1f3aef93ea23e0643d9c1808f /src/test/com/jogamp/opengl
parenta7ff8b898780762b763c0b4544728067375955b6 (diff)
FBObject: Simplify API (init/reset); Only issue automatic resetSamplingSink(..) if required; Fix resetSamplingSink(..), isBound(), ..
- Simplify API (init/reset) - use new unique methods for init and reset: - void init(final GL gl, final int newWidth, final int newHeight, final int newSamples) - does not issue resetSamplingSink(..) - boolean reset(final GL gl, final int newWidth, final int newHeight, final int newSamples) - always issues resetSamplingSink(..) - deprecated dual-use (init/reset): - boolean reset(final GL gl, final int newWidth, final int newHeight) - boolean reset(final GL gl, int newWidth, int newHeight, int newSamples, final boolean resetSamplingSink) - reset(..) no more creates a dummy 'samplingSink' instance if sampling > 0, left up to resetSamplingSink(..) - Track 'modified' state of FBObject, if size, format or any attachment has been changed since last - use(..) - syncSamplingSink(..) - resetSamplingSink(..) - Only issue resetSamplingSink(..) from syncSamplingSink(..)/use(..) if 'modified == true' +++ - Fix setSamplingSink(..), i.e. samplingSink state handling: - Validated whether given samplingSink is initialized, throws Exception if not. - Fix resetSamplingSink(..) - resets the bound state, i.e. leaves it untouched - also unbinds the samplingSink - sampleSinkDepthStencilMismatch() also returns true if this.depth/stencil == null, but samplingSink is not. - Newly created colorbuffer/-texture matches exiting colorbuffer's internal-format, if exists. - Using simplified resetSizeImpl(..) for size mismatch - Simplified samplingColorSink init check - Fix isBound() was: 'bound = bound && fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER)' fix: 'bound = bound && fbName == gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER)' - Fix detachRenderbuffer(..) validates whether detachment was successful, similar to detachColorbuffer(..)
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java45
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java4
4 files changed, 39 insertions, 24 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 9e38b0d50..a66eddfdc 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
@@ -167,7 +167,7 @@ public class TestFBOMRTNEWT01 extends UITestCase {
// FBO w/ 2 texture2D color buffers
final FBObject fbo_mrt = new FBObject();
- fbo_mrt.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
+ fbo_mrt.init(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), 0);
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;
if(fbo_mrt.getMaxColorAttachments() > 1) {
@@ -257,7 +257,7 @@ public class TestFBOMRTNEWT01 extends UITestCase {
final int w = width/step * j;
final int h = height/step * j;
System.err.println("resize: "+step_i+" -> "+j+" - "+w+"x"+h);
- fbo_mrt.reset(gl, w, h);
+ fbo_mrt.reset(gl, w, h, 0);
winctx.window.setSize(w, h);
step_i = j;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
index f8feefdcf..5eebf9cdd 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
@@ -62,14 +62,14 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFBOMix2DemosES2NEWT extends UITestCase {
- static long duration = 500; // ms
+ static long duration = 1000; // ms
static int swapInterval = 1;
static boolean showFPS = false;
static boolean forceES2 = false;
static boolean doRotate = true;
static boolean demo0Only = false;
static int globalNumSamples = 0;
- static boolean mainRun = false;
+ static boolean manual = false;
@AfterClass
public static void releaseClass() {
@@ -81,7 +81,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
final GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval);
- if(mainRun) {
+ if(manual) {
glWindow.setSize(512, 512);
} else {
glWindow.setSize(128, 128);
@@ -100,7 +100,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
}
public void dispose(final GLAutoDrawable drawable) {}
public void display(final GLAutoDrawable drawable) {
- if(mainRun) return;
+ if(manual) return;
final int dw = drawable.getSurfaceWidth();
final int dh = drawable.getSurfaceHeight();
@@ -112,18 +112,24 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
snapshot(i++, "msaa"+demo.getMSAA(), drawable.getGL(), screenshot, TextureIO.PNG, null);
}
if( 3 == c ) {
+ demo.setMSAA(4);
+ } else if( 6 == c ) {
new Thread() {
@Override
public void run() {
- demo.setMSAA(4);
+ glWindow.setSize(dw+64, dh+64);
} }.start();
- } else if( 6 == c ) {
+ } else if( 9 == c ) {
+ demo.setMSAA(8);
+ } else if( 12 == c ) {
+ demo.setMSAA(0);
+ } else if( 15 == c ) {
new Thread() {
@Override
public void run() {
- demo.setMSAA(8);
+ glWindow.setSize(dw+128, dh+128);
} }.start();
- } else if(9 == c) {
+ } else if( 18 == c ) {
c=0;
new Thread() {
@Override
@@ -203,8 +209,8 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
}
@Test
- public void test01_Main() throws InterruptedException {
- if( mainRun ) {
+ public void test00_Manual() throws InterruptedException {
+ if( manual ) {
final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
caps.setAlphaBits(1);
runTestGL(caps, globalNumSamples);
@@ -212,17 +218,25 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
}
@Test
- public void test01() throws InterruptedException {
- if( mainRun ) return ;
+ public void test01_startMSAA0() throws InterruptedException {
+ if( manual ) return ;
final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
caps.setAlphaBits(1);
runTestGL(caps, 0);
}
+ @Test
+ public void test02_startMSAA4() throws InterruptedException {
+ if( manual ) return ;
+ final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
+ caps.setAlphaBits(1);
+ runTestGL(caps, 4);
+ }
+
public static void main(final String args[]) throws IOException {
boolean waitForKey = false;
- mainRun = true;
+ manual = false;
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -244,13 +258,14 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
demo0Only = true;
} else if(args[i].equals("-wait")) {
waitForKey = true;
- } else if(args[i].equals("-nomain")) {
- mainRun = false;
+ } else if(args[i].equals("-manual")) {
+ manual = true;
}
}
System.err.println("swapInterval "+swapInterval);
System.err.println("forceES2 "+forceES2);
+ System.err.println("manual "+manual);
if(waitForKey) {
final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java
index 4df959333..d99cba50b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java
@@ -49,7 +49,7 @@ public class FBOMix2DemosES2 implements GLEventListener {
private final GearsES2 demo0;
private final RedSquareES2 demo1;
private final int swapInterval;
- private int numSamples;
+ private volatile int numSamples;
private boolean demo0Only;
@@ -156,8 +156,8 @@ public class FBOMix2DemosES2 implements GLEventListener {
}
private void initFBOs(final GL gl, final GLAutoDrawable drawable) {
- fbo0.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, false);
- fbo1.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, false);
+ fbo0.init(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples);
+ fbo1.init(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples);
if(fbo0.getNumSamples() != fbo1.getNumSamples()) {
throw new InternalError("sample size mismatch: \n\t0: "+fbo0+"\n\t1: "+fbo1);
}
@@ -182,8 +182,8 @@ public class FBOMix2DemosES2 implements GLEventListener {
}
private void resetFBOs(final GL gl, final GLAutoDrawable drawable) {
- fbo0.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, true);
- fbo1.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, true);
+ fbo0.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples);
+ fbo1.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples);
if(fbo0.getNumSamples() != fbo1.getNumSamples()) {
throw new InternalError("sample size mismatch: \n\t0: "+fbo0+"\n\t1: "+fbo1);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
index 69319561d..066003956 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
@@ -144,7 +144,7 @@ public class TextureDraw02ES2ListenerFBO implements GLEventListener {
}
private void initFBOs(final GL gl, final int width, final int height) {
- fbo0.reset(gl, width, height, numSamples, false);
+ fbo0.init(gl, width, height, numSamples);
numSamples = fbo0.getNumSamples();
if(numSamples>0) {
@@ -160,7 +160,7 @@ public class TextureDraw02ES2ListenerFBO implements GLEventListener {
}
private void resetFBOs(final GL gl, final int width, final int height) {
- fbo0.reset(gl, width, height, numSamples, true);
+ fbo0.reset(gl, width, height, numSamples);
numSamples = fbo0.getNumSamples();
if(numSamples>0) {
fbo0Tex = fbo0.getSamplingSink().getTextureAttachment();