diff options
author | Sven Gothel <[email protected]> | 2012-09-08 19:45:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-08 19:45:11 +0200 |
commit | 9036376b7806a5fc61590bf49404eb71830de92f (patch) | |
tree | e12bd10755b88b8fb5318268c1243da0b5467157 /src/test | |
parent | d22ac65d0f841e4c3698ec817d4ebbfdb7ee25a0 (diff) |
Fix window mode attribute bit FBO_BIT usage in platform dependent code (map it to native type) ; OSX Caps selection ; WGL/GDI BITMAP fix
Fix window mode attribute bit FBO_BIT usage in platform dependent code (map it to native type)
All platform dependent winAttrBit mapping: 'nativeType -> winAttrBit' and 'GLCapabilities -> winAttrBits'
shall replace FBO_BIT w/ the native type of the wrapper surface, i.e. WINDOW_BIT (X11, WGL, CGL) or PBUFFER_BIT (EGL).
This condenses to changes in
- EGLGraphicsConfiguration: EGLConfigDrawableTypeBits / GLCapabilities2AttribList
- X11GLXGraphicsConfiguration: FBCfgDrawableTypeBits, XVisualInfo2GLCapabilities / GLCapabilities2AttribList
- WindowsWGLGraphicsConfiguration: AttribList2DrawableTypeBits, PFD2DrawableTypeBits / GLCapabilities2AttribList
- OSX CGL/NS requires changes in MacOSXCGLContext, i.e. fix the surface mode of
NSPixelFormat2GLCapabilities, CGLPixelFormat2GLCapabilities results.
This change is included in the upcoming commit (class is heavily edited).
OSX chooseGraphicsConfigurationStatic: Add missing 'GLGraphicsConfigurationUtil.fixGLCapabilities(..)' call
- all platform impl. require to fix the given user caps due to the new offscreen auto selection mode
WindowsWGLGraphicsConfiguration*: ARB / GDI updateGraphicsConfiguration*()
- ARB method detects early whether it's suitable for given HDC, i.e. in case of BITMAP (it's not here)
- GDI methods detect failure while choosing PFD and doesn't care of DOUBLEBUFFER in case of bitmap (fixes BITMAP usage)
Capabilities/GLCapabilities:
- Fix missing double-buffer check in GLCapabilities.equals()
- add 'copyFrom(..)' method copy all data from give caps
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLCapabilities01NEWT.java | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLCapabilities01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLCapabilities01NEWT.java index 0782e8915..cd1107e25 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLCapabilities01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLCapabilities01NEWT.java @@ -39,6 +39,8 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; +import jogamp.opengl.GLGraphicsConfigurationUtil; + import org.junit.Assert; import org.junit.Test; @@ -61,9 +63,19 @@ public class TestGLCapabilities01NEWT extends UITestCase { return true; } - void doTest(GLCapabilities reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); - + + final GLCapabilitiesImmutable expGLCaps; + if( GLGraphicsConfigurationUtil.isGLCapabilitiesOffscreenAutoSelection(reqGLCaps) ) { + final GLDrawableFactory f = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); + final boolean fboAvailable = true ; // f.canCreateFBO(null, reqGLCaps.getGLProfile()); + final boolean pbufferAvailable = f.canCreateGLPbuffer(null); + expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, fboAvailable, pbufferAvailable); + } else { + expGLCaps = reqGLCaps; + } + System.out.println("Expected GL Caps: "+expGLCaps); // // Create native windowing resources .. X11/Win/OSX // @@ -108,13 +120,13 @@ public class TestGLCapabilities01NEWT extends UITestCase { Assert.assertTrue(chosenGLCaps.getBlueBits()>5); Assert.assertTrue(chosenGLCaps.getRedBits()>5); Assert.assertTrue(chosenGLCaps.getDepthBits()>4); - Assert.assertEquals(reqGLCaps.isOnscreen(), chosenGLCaps.isOnscreen()); - Assert.assertEquals(reqGLCaps.isFBO(), chosenGLCaps.isFBO()); - Assert.assertEquals(reqGLCaps.isPBuffer(), chosenGLCaps.isPBuffer()); - Assert.assertEquals(reqGLCaps.isBitmap(), chosenGLCaps.isBitmap()); + Assert.assertEquals(expGLCaps.isOnscreen(), chosenGLCaps.isOnscreen()); + Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO()); + Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer()); + Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap()); if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) { // dbl buffer may be disabled w/ offscreen pbuffer and bitmap - Assert.assertEquals(reqGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered()); + Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered()); } GLContext context = drawable.createContext(null); @@ -142,33 +154,33 @@ public class TestGLCapabilities01NEWT extends UITestCase { } } - //@Test - public void testGL2OffScreenAutoDblBuf() throws InterruptedException { + @Test + public void testGL2OnScreenDblBuf() throws InterruptedException { if(!checkProfile(GLProfile.GL2)) { return; } final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); - reqGLCaps.setOnscreen(false); doTest(reqGLCaps, new GearsES2(1)); } - - // @Test - public void testGL2OffScreenFBODblBuf() throws InterruptedException { + + @Test + public void testGL2OffScreenAutoDblBuf() throws InterruptedException { if(!checkProfile(GLProfile.GL2)) { return; } final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); reqGLCaps.setOnscreen(false); - reqGLCaps.setFBO(true); doTest(reqGLCaps, new GearsES2(1)); } - + @Test - public void testGL2OnScreenDblBuf() throws InterruptedException { + public void testGL2OffScreenFBODblBuf() throws InterruptedException { if(!checkProfile(GLProfile.GL2)) { return; } final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); doTest(reqGLCaps, new GearsES2(1)); } @@ -204,6 +216,27 @@ public class TestGLCapabilities01NEWT extends UITestCase { } @Test + public void testES2OffScreenAutoDblBuf() throws InterruptedException { + if(!checkProfile(GLProfile.GLES2)) { + return; + } + final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + reqGLCaps.setOnscreen(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OffScreenFBODblBuf() throws InterruptedException { + if(!checkProfile(GLProfile.GLES2)) { + return; + } + final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test public void testES2OffScreenPbufferDblBuf() throws InterruptedException { if(!checkProfile(GLProfile.GLES2)) { return; |