diff options
author | Sven Gothel <[email protected]> | 2023-08-18 14:15:02 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-18 14:15:02 +0200 |
commit | d17d807a76ba9cb940542264fcad9cf71c7ec585 (patch) | |
tree | ff7b95380ae9560988d03e6f853acfaa7cff450e | |
parent | 142b1b8342c1ddb41878230051706db5c03033dd (diff) |
Bug 1310: Detect missing glViewport(..) on Windows before GLEventListener.reshape(..) when re-adding GLJPanel
When re-adding GLJPanel on Windows glViewport()
is not called through
- GLJPanel.Updater.display()
- GLDrawableHelper.reshape()
- GLDrawableHelper.setViewportAndClear()
Instead the following sequence is called due to sendReshape == false:
- GLJPanel.Updater.display()
- GLDrawableHelper.display() ** missing glViewport(..) **
This bug is not visible on X11 or MacOS since the glViewport
is only set to a different user value on Windows ...
-rwxr-xr-x | make/scripts/tests-win.bat | 3 | ||||
-rwxr-xr-x | make/scripts/tests-x64-dbg.bat | 3 | ||||
-rw-r--r-- | make/scripts/tests.sh | 5 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelReadd01Bug1310AWT.java | 26 |
4 files changed, 31 insertions, 6 deletions
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index 8c6970f33..49495f636 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -31,6 +31,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimat REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLJPanel01AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelResize01AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasResize01AWT %* +scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelReadd01Bug1310AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestGLCanvasSWTNewtCanvasSWTPosInTabs %* @@ -39,7 +40,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 REM scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo20 %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.ManualHiDPIBufferedImage01AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 %* -scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSingleGLInJSliderNewtAWT %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSingleGLInJSliderNewtAWT %* REM diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat index 2fcf199ae..14a8e85ac 100755 --- a/make/scripts/tests-x64-dbg.bat +++ b/make/scripts/tests-x64-dbg.bat @@ -71,7 +71,8 @@ REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.GLJPanel" REM set D_ARGS="-Djogl.gljpanel.noverticalflip"
REM set D_ARGS="-Dnewt.debug=all"
REM set D_ARGS="-Dnewt.debug.Window"
-set D_ARGS="-Dnewt.debug.Window" "-Dnativewindow.debug.JAWT"
+REM set D_ARGS="-Dnewt.debug.Window" "-Dnativewindow.debug.JAWT"
+set D_ARGS="-Djogl.debug.GLJPanel" "-Dnativewindow.debug.JAWT"
REM set D_ARGS="-Dnativewindow.debug.SWT" "-Dnewt.debug.Window" "-Djogl.debug.GLCanvas"
REM set D_ARGS="-Dnativewindow.debug.JFX" "-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 4d7a017af..aefa5fdd6 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -201,6 +201,7 @@ function jrun() { #D_ARGS="-Dnativewindow.debug.JAWT -Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Dnewt.debug.Window" #D_ARGS="-Dnativewindow.debug.JAWT -Djogamp.debug.TaskBase.TraceSource" #D_ARGS="-Dnativewindow.debug.JAWT" + D_ARGS="-Djogl.debug.GLJPanel" #D_ARGS="-Djogl.debug.GLContext.TraceSwitch" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch" #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.FixedFuncPipeline -Djogl.debug.GLSLState -Djogl.debug.GLSLCode" @@ -508,7 +509,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLJPanel01AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelResize01AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasResize01AWT $* -#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelReadd01Bug1310AWT $* +testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelReadd01Bug1310AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* #testswt com.jogamp.opengl.test.junit.jogl.swt.TestGLCanvasSWTNewtCanvasSWTPosInTabs $* @@ -1002,7 +1003,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo10 $* #testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo11 $* #testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $* -testawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $* +#testawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $* #testawt com.jogamp.opengl.demos.es2.GearsES2 $* #testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemoU01a $* #testnoawt com.jogamp.opengl.demos.graph.ui.UILayoutGrid01 $* diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelReadd01Bug1310AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelReadd01Bug1310AWT.java index 464abb904..3d5437a27 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelReadd01Bug1310AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelReadd01Bug1310AWT.java @@ -33,6 +33,7 @@ import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; @@ -50,6 +51,7 @@ import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; +import org.junit.Assert; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -109,10 +111,13 @@ public class TestGLJPanelReadd01Bug1310AWT extends UITestCase { toolbar.add(new AbstractAction("Remove and add") { @Override public void actionPerformed(final ActionEvent e) { + System.err.println("XXX: Remove"); _container.removeAll(); + System.err.println("XXX: ReAdd.0: glJPanel-Size: "+glJPanel[0].getSize()); _container.add(_glJPanel); _glJPanel.invalidate(); _glJPanel.repaint(); + System.err.println("XXX: ReAdd.X: glJPanel-Size: "+glJPanel[0].getSize()); } }); @@ -138,11 +143,13 @@ public class TestGLJPanelReadd01Bug1310AWT extends UITestCase { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { + System.err.println("XXX: Remove"); container[0].removeAll(); + System.err.println("XXX: ReAdd.0: glJPanel-Size: "+glJPanel[0].getSize()); container[0].add(glJPanel[0]); glJPanel[0].invalidate(); glJPanel[0].repaint(); - + System.err.println("XXX: ReAdd.X: glJPanel-Size: "+glJPanel[0].getSize()); } }); } catch( final Throwable throwable ) { @@ -169,7 +176,12 @@ public class TestGLJPanelReadd01Bug1310AWT extends UITestCase { public void test00() throws InterruptedException, InvocationTargetException { // test(new GLCapabilities(null), new RedSquareES2()); test(new GLCapabilities(null), new MyRotTriangle()); + System.err.println("Exp GL_Viewport: "+Arrays.toString(exp_gl_viewport)); + System.err.println("Has GL_Viewport: "+Arrays.toString(has_gl_viewport)); + Assert.assertArrayEquals(exp_gl_viewport, has_gl_viewport); } + final int[] exp_gl_viewport = { -1, -1, -1, -1 }; + final int[] has_gl_viewport = { -1, -1, -1, -1 }; public static void main(final String[] args) { for(int i=0; i<args.length; i++) { @@ -210,7 +222,9 @@ public class TestGLJPanelReadd01Bug1310AWT extends UITestCase { @Override public void init(final GLAutoDrawable drawable) { - System.err.println("GLEL init, swap-ival "+drawable.getGL().getSwapInterval()); + System.err.println("GLEL init: Surface "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceWidth()+ + ", "+drawable.getClass().getSimpleName()+ + ", swap-ival "+drawable.getGL().getSwapInterval()); theta = 0; s = 0; c = 0; @@ -219,6 +233,14 @@ public class TestGLJPanelReadd01Bug1310AWT extends UITestCase { @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { + exp_gl_viewport[0] = x; + exp_gl_viewport[1] = y; + exp_gl_viewport[2] = w; + exp_gl_viewport[3] = h; + System.err.println("GLEL reshape: Surface "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceWidth()+ + ", reshape "+x+"/"+y+" "+w+"x"+h); + final GL2 gl = drawable.getGL().getGL2(); + gl.glGetIntegerv(GL.GL_VIEWPORT, has_gl_viewport, 0); } private void update() { |