Created attachment 350 [details] screenshot While evaluating jdk1.7 (1.7.0_06-ea) on OSX I found that resizing GLCanvas no longer works as expected. This can be easily reproduced by running an example like SimpleScene (source at the bottom of https://sites.google.com/site/justinscsstuff/jogl-tutorial-3). When resizing the window, the displayed animation is scaled down to fill only a small rectangle in the bottom left corner of the window (see attached image). This seems to be related to an open issue filed on the "processing" issue tracker (http://code.google.com/p/processing/issues/detail?id=1070) where a similar behaviour is described in connection with a jogl based opengl renderer. I reproduced the issue on 2 different machines running OSX 10.6.8 and 10.7.4. test.log outputs for both machines are also attached. While resizing console log continuously showed entries like the following: "java[11246:707] invalid drawable" The canvas size reported by canvas.getWidth()/.getHeight() was correct (not matching the small rectangle but the outer frame). See also http://forum.jogamp.org/Resize-GLCanvas-broken-on-OSX-and-JDK7-td4025223.html
Created attachment 351 [details] test1.log
Created attachment 352 [details] test2.log
Do you reproduce the same problem with a plan java.awt.Canvas? I would like to know whether this bug really comes from JOGL (or from AWT).
No, adding the canvas below to a java.awt.Frame paints and resizes as expected: public static class SimpleCanvas extends java.awt.Canvas { @Override public void paint(Graphics g) { int w = getWidth(); int h = getHeight(); g.setColor(Color.RED); g.fillOval(10, 10, w - 20, h - 20); } }
Added unit tests (enhancements and new ones) trying to [visually] cover this situation using screenshots. See JOGL commit c03ad260aea0b4a640a5eeb50a206688c531b591, especially test case: com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT Let's use these screenshots and test cases to analyze the behavior. Your setup: - Mac OS X 10.7.4 (os), - Java Version: 1.7.0_06-ea, VM: Java HotSpot(TM) 64-Bit Server VM - GL_RENDERER NVIDIA GeForce 9400M OpenGL Engine GL_VERSION 2.1 NVIDIA-7.18.18 GLSL true, has-compiler: true, version: 1.20 Ours default: <https://jogamp.org/chuck/job/jogl/770/label=macosx-10_6-x86_64-nvidia/consoleText> - Mac OS X 10.7.4 (os), - Java Version: 1.6.0_33, VM: Java HotSpot(TM) 64-Bit Server VM - GL_RENDERER NVIDIA GeForce 320M OpenGL Engine GL_VERSION 2.1 NVIDIA-7.18.18 GLSL true, has-compiler: true, version: 1.20 Will also test w/ Java 1.7* ofc. .. Lets check the results of the new builds staring from b771: <https://jogamp.org/chuck/view/fwd/job/jogl/771/> Test files and log (sections) of interest: - com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT - TestGLReadBufferUtilTextureIOWrite02AWT.*.png
(In reply to comment #5) > > com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT Above test triggers a NPE (w/ offscreen layer use, resize -> recreate) .. The new tests allows us to nail it down, stay tuned :)
(In reply to comment #6) > (In reply to comment #5) > > > > com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT > > Above test triggers a NPE (w/ offscreen layer use, resize -> recreate) .. > The new tests allows us to nail it down, stay tuned :) Fixed the NPE, good cleanup for stability catching destruction cases unhandled yet. Now the test case reproduces your experience w/ java7 while working flawless w/ java6 - both using the offscreen layering. (Ofc w/ java7 no onscreen rendering is available) Minor note: the resize width is wrong on OSX. +++ Interesting piece is that even though the screenshot does show a resized picture, but on the actual screen it stays small. In some test run it freezes/deadlocks at: AWT-EventQueue-0: at jogamp.opengl.macosx.cgl.CGL.setNSOpenGLLayerSwapInterval(Native Method) at jogamp.opengl.macosx.cgl.MacOSXCGLContext$NSOpenGLImpl.setSwapInterval(MacOSXCGLContext.java:589) at jogamp.opengl.macosx.cgl.MacOSXCGLContext.setSwapIntervalImpl(MacOSXCGLContext.java:296) at javax.media.opengl.GLContext.setSwapInterval(GLContext.java:628) at jogamp.opengl.gl4.GL4bcImpl.setSwapInterval(GL4bcImpl.java:34143) at com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2.init(GearsES2.java:177) +++ Will dig into it deeper ..
Fixed. OSXUtil.CreateCALayer*(..) needs to have the layer target size (if known) otherwise it's possible openjdk7 uses a zero sized CALayer. +++ Tested against: openjdk version "1.7.0-jdk7u5-b30" OpenJDK Runtime Environment (build 1.7.0-jdk7u5-b30-20120621) OpenJDK 64-Bit Server VM (build 23.2-b05, mixed mode) and java version "1.6.0_33" Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720) Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
Thanks! I can confirm the fix with my setup. Though there still is a difference between jdk6 and jdk7. During resizing with jdk7 the canvas is flickering heavily, in fact, when resizing its more like the animation disappears and reappears after resizing has finished. jdk6 resizing goes smoothly without disturbing the animation and without any noticeable flickering.