reshape not called in 2nd GLCanvas

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
I have two GLCanvas instances, both created in the constructor of my JFrame subclass.  Each gets its own GLEventListener attached; both GLEventListener instances are made from the same GLEventListener subclass.

On startup, the reshape() method is called on both GLEventListeners, so I know everything is hooked up.  (It is a little hard to tell the calls apart from the stack trace, but the height and width arguments give it away.)

However, when I resize the window, only the first GLEventListener's reshape() is called.  The effect is that the 2nd canvas floats where it was, while the rest of the window repaints underneath it.  That canvas stays fixed in its original screen location until the window is closed.

Note that the Swing layout for my JFrame means that the first canvas size *does* need to change, but the second canvas' *position* needs to change, but not its size.
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
PS: you can see this happen if you download vZome and run it:  https://vzome.com
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
Here is the result of setting -Djogl.debug.GLCanvas=true.  The reshape events corresponding to resizing the window are the last few lines.

AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0: Info: addNotify - start, bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0], isBeansDesignTime false
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0: Context created: has shared false
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0: Info: addNotify - end
AWT-EventQueue-0: Info: addNotify - start, bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0], isBeansDesignTime false
AWT-EventQueue-0: Context created: has shared false
AWT-EventQueue-0: Info: addNotify - end
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
AWT-EventQueue-0-FPSAWTAnimator#00-Timer0: Info: GLCanvas display - skipped GL render, drawable not valid yet
reshape: 2000 2000
AWT-EventQueue-0: GLCanvas.reshape.0 canvas0 resize [ this 2000x2000, pixelScale [1.0, 1.0]] -> 2000x2000 * [1.0, 1.0] -> 2000x2000 - surfaceHandle 0x7ff6421bdfb0
AWT-EventQueue-0: Realized Drawable: isRealized true, GLFBODrawableImpl[Initialized false, realized true, texUnit 0, samples 4,
	Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@597e8c1c,
	Handle    0x7ff6421bdfb0,
	Caps      GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	fboI back 0, front 0, num 0,
	FBO front read 0, null,
	FBO back  write 0, null,
	Surface   JAWTWindow[0x4193e818][JVM version: 17.0.4 (17.0.4 update 0)
JAWT version: 0x80010004, CA_LAYER: true, isLayeredSurface true, bounds [ 0 / 0  2000 x 2000 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], pixelScale 1.0x1.0, shallUseOffscreenLayer false, isOffscreenLayerSurface true, attachedSurfaceLayer 0x0, windowHandle 0x7ff64505b2e0, surfaceHandle 0x7ff6421bdfb0, bounds [ 0 / 0  2000 x 2000 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], window [0/0 2000x2000], pixels[scale 1.0, 1.0 -> 2000x2000], visible true, lockedExt false,
	config AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection Display 458651144, unitID 0, awtDevice sun.awt.CGraphicsDevice@22321a07, handle 0x0], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]],
	CGLGraphicsConfig[Display 458651144],
	encapsulated MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x5feb4155]], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]]]],
	awtComponent AWT-GLCanvas[Realized true,
	jogamp.opengl.GLFBODrawableImpl,
	Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@597e8c1c,
	handle    0x7ff6421bdfb0,
	Drawable size 2000x2000 surface[2000x2000],
	AWT[pos 0/0, size 2000x2000,
	visible true, displayable true, showing false,
	AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection Display 458651144, unitID 0, awtDevice sun.awt.CGraphicsDevice@22321a07, handle 0x0], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]],
	CGLGraphicsConfig[Display 458651144],
	encapsulated MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x5feb4155]], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]]]]]],
	surfaceLock <72d838d8, 2c55cdb3>[count 0, qsz 0, owner <NULL>]]]
AWT-EventQueue-0-FPSAWTAnimator#01-Timer1: Info: GLCanvas display - skipped GL render, drawable not valid yet
reshape: 199 176
AWT-EventQueue-0: GLCanvas.reshape.0 canvas1 resize [ this 199x176, pixelScale [1.0, 1.0]] -> 199x176 * [1.0, 1.0] -> 199x176 - surfaceHandle 0x7ff642333ad0
AWT-EventQueue-0: Realized Drawable: isRealized true, GLFBODrawableImpl[Initialized false, realized true, texUnit 0, samples 4,
	Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@597e8c1c,
	Handle    0x7ff642333ad0,
	Caps      GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	fboI back 0, front 0, num 0,
	FBO front read 0, null,
	FBO back  write 0, null,
	Surface   JAWTWindow[0x1e85081c][JVM version: 17.0.4 (17.0.4 update 0)
JAWT version: 0x80010004, CA_LAYER: true, isLayeredSurface true, bounds [ 6 / 18  199 x 176 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], pixelScale 1.0x1.0, shallUseOffscreenLayer false, isOffscreenLayerSurface true, attachedSurfaceLayer 0x0, windowHandle 0x7ff6421c2ec0, surfaceHandle 0x7ff642333ad0, bounds [ 6 / 18  199 x 176 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], window [6/18 199x176], pixels[scale 1.0, 1.0 -> 199x176], visible true, lockedExt false,
	config AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection Display 458651144, unitID 0, awtDevice sun.awt.CGraphicsDevice@22321a07, handle 0x0], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]],
	CGLGraphicsConfig[Display 458651144],
	encapsulated MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x5feb4155]], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]]]],
	awtComponent AWT-GLCanvas[Realized true,
	jogamp.opengl.GLFBODrawableImpl,
	Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@597e8c1c,
	handle    0x7ff642333ad0,
	Drawable size 199x176 surface[199x176],
	AWT[pos 6/18, size 199x176,
	visible true, displayable true, showing false,
	AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection Display 458651144, unitID 0, awtDevice sun.awt.CGraphicsDevice@22321a07, handle 0x0], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]],
	CGLGraphicsConfig[Display 458651144],
	encapsulated MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x5feb4155]], idx 0],
	chosen    GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]]]]]],
	surfaceLock <1b610370, 28cce63c>[count 0, qsz 0, owner <NULL>]]]
reshape: 1575 921
AWT-EventQueue-0: GLCanvas.reshape.0 canvas0 resize [ this 1575x921, pixelScale [1.0, 1.0]] -> 1575x921 * [1.0, 1.0] -> 1575x921 - surfaceHandle 0x7ff6421bdfb0

AWT-EventQueue-0: Reshape: 1575x921
AWT-EventQueue-0: Reshape: 199x176



reshape: 1561 921
AWT-EventQueue-0: GLCanvas.reshape.0 canvas0 resize [ this 1561x921, pixelScale [1.0, 1.0]] -> 1561x921 * [1.0, 1.0] -> 1561x921 - surfaceHandle 0x7ff6421bdfb0
AWT-EventQueue-0: Reshape: 1561x921
reshape: 1542 921
AWT-EventQueue-0: GLCanvas.reshape.0 canvas0 resize [ this 1542x921, pixelScale [1.0, 1.0]] -> 1542x921 * [1.0, 1.0] -> 1542x921 - surfaceHandle 0x7ff6421bdfb0
AWT-EventQueue-0: Reshape: 1542x921
reshape: 1533 921
AWT-EventQueue-0: GLCanvas.reshape.0 canvas0 resize [ this 1533x921, pixelScale [1.0, 1.0]] -> 1533x921 * [1.0, 1.0] -> 1533x921 - surfaceHandle 0x7ff6421bdfb0
AWT-EventQueue-0: Reshape: 1533x921
reshape: 1527 921
AWT-EventQueue-0: GLCanvas.reshape.0 canvas0 resize [ this 1527x921, pixelScale [1.0, 1.0]] -> 1527x921 * [1.0, 1.0] -> 1527x921 - surfaceHandle 0x7ff6421bdfb0
AWT-EventQueue-0: Reshape: 1527x921
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

gouessej
Administrator
In reply to this post by scott+jogamp@vorthmann.org
Hello

It's hard to answer without the source code. Do you use an animator?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
No, I don't use an animator to the best of my knowledge.

Note that the problem seems to occur on Macs only, not on Windows.  I have no data for Linux.


The source will be hard to wade through without a sequence diagram... but it is all available on GitHub.

My GLEventListener is here:  

https://github.com/vZome/vzome/blob/master/desktop/src/main/java/org/vorthmann/zome/render/jogl/JoglRenderingViewer.java

The factory that constructs it is here:

https://github.com/vZome/vzome/blob/master/desktop/src/main/java/org/vorthmann/zome/render/jogl/JoglFactory.java

The misbehaving GLCanvas is attached to its container here:

https://github.com/vZome/vzome/blob/b0b9d45a5c4dacd35bc8d614a8e93998b3f24273/desktop/src/main/java/org/vorthmann/zome/ui/CameraControlPanel.java#L103

The correctly behaving GLCanvas is attached to its container here:

https://github.com/vZome/vzome/blob/b0b9d45a5c4dacd35bc8d614a8e93998b3f24273/desktop/src/main/java/org/vorthmann/zome/ui/ModelPanel.java#L79

and those two JPanels are constructed here (separated by 10 lines or so):

https://github.com/vZome/vzome/blob/b0b9d45a5c4dacd35bc8d614a8e93998b3f24273/desktop/src/main/java/org/vorthmann/zome/ui/DocumentFrame.java#L551
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
My friend running the app on Windows reports that he gets the same reshape calls, but the app works perfectly for him, so the reshape calls (or their absence) is a red herring... probably not related.
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

gouessej
Administrator
My question was silly, you use the FPSAnimator in JoglRenderingViewer, it even appears in the logs but I'm not sure that all your drawables use an animator.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
This post was updated on .
Right, I create an animator, but apparently don't use it.  Is its normal function just to report frames-per-second?

This issue has come and gone in vZome over the years, and I can see it when I run old versions.  In late 2019, vZome 6.0 still used Java3d, and it had this problem.  When I ported to pure JOGL (removing Java3d) for vZome 7.0, the problem disappeared.  Late 2022 I updated from Java 8 to Java 17 for vZome 7.1, and the problem reappeared.  Each of those transitions would have picked up a newer JOGL RC, though I'm not sure there was a new release last year.

By the way, since I have a Swing app, I've tried replacing the GLCanvas with GLJPanel, but I get black canvases, nothing rendered at all.  Is there an extra step with GLJPanel?
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

gouessej
Administrator
Maybe you should disable a build-in shader used in GLJPanel to fix your problem of black canvas, use the system property jogl.gljpanel.noglsl.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
Wow, that did it!  Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

gouessej
Administrator
You're welcome. Please can you tell me at least which graphics card you use and which version of OS X?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

scott+jogamp@vorthmann.org
Sure.  FWIW, I'm pretty certain all Macs exhibit this defect.

macOS Monterey, 12.6.1

Intel UHD Graphics 630 1536 MB

Mac Mini 2018
Reply | Threaded
Open this post in threaded view
|

Re: reshape not called in 2nd GLCanvas

gouessej
Administrator
This problem deserves a bug report. Do you reproduce it with one of our JUnit tests?
Julien Gouesse | Personal blog | Website