Hi. I created issue #63 to request an enhancement, and I’d like some opinions on it, please. I don’t know how many developers of Jogl are on the forum (vs developers using Jogl), but I’d appreciate thoughts about whether there is another way to do it, whether it makes sense, and whether there is a chance it would be done.
https://jogl.dev.java.net/issues/show_bug.cgi?id=63
Here’s a summary. The Jogl User’s Guide, in the Multithreading Issues sections, mentions two ways of interacting with Jogl: rendering on demand in the AWT thread, or continuously calling display() in a separate thread. Our system is in between, repainting on certain events rather than continuously, but using a separate thread from AWT so AWT can update controls while we’re rendering.
Currently, if I set NoAutoRedrawMode to true and call display when needed, an app using our system looks fine while I’m rotating or making other updates that I know about. But when the GLCanvas gets a paint event, I’m never told about it, because the paint method does nothing when the NoAutoRedrawMode is true. I’d like to know about this paint event so I can redraw in this case. I don’t want to go through all the context stuff or do a swap–that will all happen when I call display after I know about the paint event.
What I’ve done is to make a change to the GLCanvas.paint() method. I added an else to the condition for no auto redraw mode, where if it does not call display, it will instead call its parent’s paint method. That parent is our viewer, and we’ve overridden the paint method, so we’d get this call and can render.
If GLCanvas were not final, I’d extend that and override the paint() method.
This seems to me to be a small change, and if you didn’t want it to be the default, could be implemented with a flag to say whether no auto redraw mode does this, say a CallParentPaint property. I think it does add another way to use Jogl without me having to implement GLCanvas myself.
However, a lot of you have developed a lot of stuff with Jogl, and I’d like to know if I’m missing something. Does this open up troubling issues with Jogl? Is it unnecessary? (If so, tell me why!) Make sense?
If (in addition to the above) I could also call display() without a swap buffers automatically happening, I’d be all set. This is because when I want to do a pick, I call GLDrawable.display(), get the GLEventListener.display() call with the context all set up, and then do my pick work. I’m not updating the back buffer, and don’t want to swap at the end. Even a boolean parameter to GLDrawable.display(), saying whether to swap at the end, would help. There are already a couple of enhancement requests related to this, so I didn’t add another.
Thanks
andy
AVS