Posted by
michalrus on
Apr 29, 2013; 4:32pm
URL: https://forum.jogamp.org/First-GLWindow-in-first-NewtCanvasAWT-doesn-t-get-repaint-when-there-are-other-windows-tp4029073.html
Hello. :)
I've got a little problem with automatic repainting of all-but-last GLWindows whenever they get covered by something. This post is a copy of
question asked on SO, that's where the formatting comes from.
---
I have two [JOGL](
https://jogamp.org/jogl/) native `GLWindow`s wrapped in `NewtCanvasAWT`.
These canvases are added to `JInternalFrame`s each. `JInternalFrame`s are added to `JDesktopPane` which is added to a `JFrame`.
I don't have an `Animator` running because `.display()` is called manually, when scene changes.
---
This setup works as expected apart from one thing:
* when the second `JInternalFrame` (order of creation) moves over the first, the first is not repainted, what is quite unexpected,
* when the first moves over the second, the second *is* repainted, as expected.
* If I add more frames, only the last one behaves as expected.
The `JInternalFrames` are identical (the same class).
The first `GLWindow` doesn't receive `WindowUpdateEvent` in `WindowListener.windowRepaint()`. The second one does.
Here's the stack trace of my `GLEventListener.display(GLAutoDrawable drawable)` from the *working* `JInternalFrame`:
java.lang.IllegalArgumentException: test
at edu.agh.tunev.ui.opengl.Scene.display(Scene.java:42)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:373)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:358)
at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:280)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:655)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:594)
at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:543)
at jogamp.opengl.GLAutoDrawableBase.defaultWindowRepaintOp(GLAutoDrawableBase.java:99)
at com.jogamp.newt.opengl.GLWindow.access$000(GLWindow.java:94)
at com.jogamp.newt.opengl.GLWindow$1.windowRepaint(GLWindow.java:107)
at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:2392)
at jogamp.newt.WindowImpl.consumeEvent(WindowImpl.java:1943)
at jogamp.newt.DisplayImpl.dispatchMessage(DisplayImpl.java:388)
at jogamp.newt.DisplayImpl.dispatchMessages(DisplayImpl.java:436)
at jogamp.newt.DisplayImpl$DispatchMessagesRunnable.run(DisplayImpl.java:371)
at jogamp.newt.DefaultEDTUtil$EventDispatchThread.run(DefaultEDTUtil.java:293)
This should also happen with the *first* frame. Why doesn't it?
---
All this does not happen when using `GLJPanel` or `GLCanvas`. However, I do not want to use AWT thread for rendering and these `GLAutoDrawable`s use it. `NEWT` native windowing toolkit uses another thread.