diff options
author | Sven Gothel <sgothel@jausoft.com> | 2012-10-05 18:46:16 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2012-10-05 18:46:16 +0200 |
commit | bab6160df764871f6fa4db040362976f028d015b (patch) | |
tree | 5b0cd475d496b883e77fb4ae1f4b7137e49ef74d /src/test/com/jogamp/opengl | |
parent | ed7d5f2e3fc696d47b10c8d62a071643bf385588 (diff) |
Refine ed7d5f2e3fc696d47b10c8d62a071643bf385588, set and restore FBO caps @ setRealized(true/false) already, refine at initialize(true)
Allowing to validate the on-/offscreen state after setRealized(true).
Adding comment in GLFBODrawable.
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java index 829739caa..d9e9b2bf3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java @@ -119,34 +119,47 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { System.out.println("Window Caps PostGL : "+window.getGraphicsConfiguration().getChosenCapabilities()); System.out.println("Drawable Post-GL(1): "+drawable.getClass().getName()+", "+drawable.getNativeSurface().getClass().getName()); - - // Check caps of GLDrawable after realization - final GLCapabilitiesImmutable chosenGLCaps = drawable.getChosenGLCapabilities(); - System.out.println("Chosen GL Caps(1): "+chosenGLCaps); - Assert.assertNotNull(chosenGLCaps); - Assert.assertTrue(chosenGLCaps.getGreenBits()>5); - Assert.assertTrue(chosenGLCaps.getBlueBits()>5); - Assert.assertTrue(chosenGLCaps.getRedBits()>5); - Assert.assertTrue(chosenGLCaps.getDepthBits()>4); - Assert.assertEquals(expGLCaps.isOnscreen(), chosenGLCaps.isOnscreen()); - Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO()); - Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer()); - Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap()); - /** Single/Double buffer cannot be checked since result may vary .. - if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) { - // dbl buffer may be disabled w/ offscreen pbuffer and bitmap - Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered()); - } */ - GLContext context = drawable.createContext(null); + // Note: FBO Drawable realization happens at 1st context.makeCurrent(), + // and hence only then it's caps can _fully_ reflect expectations, + // i.e. depth, stencil and MSAA will be valid only after makeCurrent(), + // where on-/offscreen state after setRealized(true) + // See GLFBODrawable API doc in this regard! + + + final GLCapabilitiesImmutable chosenGLCaps01 = drawable.getChosenGLCapabilities(); + System.out.println("Chosen GL Caps(1): "+chosenGLCaps01); + Assert.assertNotNull(chosenGLCaps01); + Assert.assertEquals(expGLCaps.isOnscreen(), chosenGLCaps01.isOnscreen()); + Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps01.isFBO()); + Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps01.isPBuffer()); + Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps01.isBitmap()); + + final GLContext context = drawable.createContext(null); Assert.assertNotNull(context); int res = context.makeCurrent(); Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); context.release(); - System.out.println("Chosen GL Caps(2): "+drawable.getChosenGLCapabilities()); + // Check caps of GLDrawable after realization + final GLCapabilitiesImmutable chosenGLCaps02 = drawable.getChosenGLCapabilities(); + System.out.println("Chosen GL Caps(2): "+chosenGLCaps02); System.out.println("Chosen GL CTX (2): "+context.getGLVersion()); System.out.println("Drawable Post-GL(2): "+drawable.getClass().getName()+", "+drawable.getNativeSurface().getClass().getName()); + Assert.assertNotNull(chosenGLCaps02); + Assert.assertTrue(chosenGLCaps02.getGreenBits()>5); + Assert.assertTrue(chosenGLCaps02.getBlueBits()>5); + Assert.assertTrue(chosenGLCaps02.getRedBits()>5); + Assert.assertTrue(chosenGLCaps02.getDepthBits()>4); + Assert.assertEquals(expGLCaps.isOnscreen(), chosenGLCaps02.isOnscreen()); + Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps02.isFBO()); + Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps02.isPBuffer()); + Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps02.isBitmap()); + /** Single/Double buffer cannot be checked since result may vary .. + if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) { + // dbl buffer may be disabled w/ offscreen pbuffer and bitmap + Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered()); + } */ final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, context, window, false, null) { @Override |