GLJPanel "lagging" by one frame [when multisampling is on].
Posted by bkuker on Sep 21, 2013; 12:21pm
URL: https://forum.jogamp.org/GLJPanel-lagging-by-one-frame-when-multisampling-is-on-tp4030087.html
I am changing my code to use either a GLCanvas or a GLJPanel depending on which is more likely to work / not crash / on a given JVM, OS combination.
Probably the relevant detail is that I am not animating the canvas / panel, but I am repainting it whenever the model changes.
With the GLJPanel version everything seems to "lag" one frame behind. If the user modifies a thing from state A to B my display() method gets called and draws the B state but state A stays on screen. If the user then changes from B to C the display() is called and draws the C state, but at the end the B drawing from last time is shown... So the 3d is always one user interaction behind.
Additionally I am implementing picking with colors / drawing / glReadPixels. On a mouse click I draw in pick mode, read a pixel, then clear and draw in normal textured & colored mode. Don't make fun of me it is 5 lines of code, took 3 minutes to write, and is 1000x faster than it needs to me for my app.
Anyway, the pixel values I read back with glReadPixels are from the previous frame too!
Frankly I could render everything twice, but can anyone explain what's up? I can see the display thing because of the way the GLJPanel works, but I don't understand why that would mess with the read pixels call.