diff options
author | Sven Gothel <[email protected]> | 2012-10-31 21:32:28 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-31 21:32:28 +0100 |
commit | 875a36a142b086e4f1c311440db008f816258de5 (patch) | |
tree | 0173b5added3753d7e6acdad93a3c3b46d4f15bb | |
parent | 1cd40d8284f2f8d0da9b40c4ea714a20aad97094 (diff) |
MacOSXCGLContext: Fix ShaderCode instantiation .. (duh!) ; Tested via reparenting TestParentingFocusTraversal01AWT
4 files changed, 18 insertions, 25 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 100117fa1..05409e819 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -276,6 +276,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $* +testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $* @@ -438,7 +439,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 $* # diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 518d97067..360b7457b 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -138,32 +138,19 @@ public abstract class MacOSXCGLContext extends GLContextImpl } } - /** Static instances of GL3 core shader code, initialized lazy when required - never destroyed. */ - private static Object gl3ShaderLock = new Object(); - private static volatile boolean gl3VertexShaderInitialized = false; - private static ShaderCode gl3VertexShader = null; - private static ShaderCode gl3FragmentShader = null; + private static final String shaderBasename = "texture01_xxx"; private static ShaderProgram createCALayerShader(GL3 gl) { - // Create vertex & fragment shader code objects - if( !gl3VertexShaderInitialized ) { // volatile OK - synchronized( gl3ShaderLock ) { - if( !gl3VertexShaderInitialized ) { - final String shaderBasename = "texture01_xxx"; - gl3VertexShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, - "../../shader", "../../shader/bin", shaderBasename, true); - gl3FragmentShader = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class, - "../../shader", "../../shader/bin", shaderBasename, true); - gl3VertexShader.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp); - gl3FragmentShader.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp); - gl3VertexShaderInitialized = true; - } - } - } // Create & Link the shader program final ShaderProgram sp = new ShaderProgram(); - sp.add(gl3VertexShader); - sp.add(gl3FragmentShader); + final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, + "../../shader", "../../shader/bin", shaderBasename, true); + final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class, + "../../shader", "../../shader/bin", shaderBasename, true); + vp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp); + fp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp); + sp.add(vp); + sp.add(fp); if(!sp.link(gl, System.err)) { throw new GLException("Couldn't link program: "+sp); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java index f7881615d..15393e8ea 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java @@ -48,7 +48,9 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { } public void keyTyped(KeyEvent e) { - if(e.getKeyChar()=='d') { + if(e.getKeyChar()=='i') { + System.err.println(glWindow); + } else if(e.getKeyChar()=='d') { glWindow.setUndecorated(!glWindow.isUndecorated()); } else if(e.getKeyChar()=='f') { glWindow.setFullscreen(!glWindow.isFullscreen()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java index f39b5df3b..d6f1f817a 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java @@ -68,12 +68,13 @@ public class TestParentingFocusTraversal01AWT extends UITestCase { static long durationPerTest = numFocus * 200; static GLCapabilities glCaps; static boolean manual = false; + static boolean forceGL3 = false; @BeforeClass public static void initClass() { glSize = new Dimension(200,200); fSize = new Dimension(300,300); - glCaps = new GLCapabilities(null); + glCaps = new GLCapabilities( forceGL3 ? GLProfile.get(GLProfile.GL3) : null ); } @Test @@ -314,6 +315,8 @@ public class TestParentingFocusTraversal01AWT extends UITestCase { durationPerTest = atoi(args[++i]); } else if(args[i].equals("-manual")) { manual = true; + } else if(args[i].equals("-gl3")) { + forceGL3 = true; } } String tstname = TestParentingFocusTraversal01AWT.class.getName(); |