I might be wrong about this, but I believe that the use of the AWT event queue by JOGL may be problematic. Consider the following case which I have come across whilst trying to implement a JOGL application:
- I have window into which I am rendering OpenGL (using GLCanvas)
- I have a seperate window in which I am using Swing to draw a graph of nodes. These nodes can be dragged around by the user (by clicking and dragging with the mouse).
I am seeing a problem that when Vsync is enabled there is very noticable “lag” when the user drags nodes using the mouse. By that I mean that the node being dragged lags behind the mouse’s actual position. I suspect the reason for this is that swapBuffers is being called in the AWT thread, which is blocked until a refresh, which delays the processing of the mouse events and subsequent repaints necessary to implement to dragging functionality.
This is undesirable. Wouldn’t it be better if JOGL used a seperate thread to prevent these kind of unwanted interactions (and to increase performance, when AWT and JOGL are both used on multi-core processors)? As an aside, this would (presumably) also give developers better control when setting thread priorities.
Does anyone know of a workaround to this problem, or can anyone spot a mistake with my reasoning?
Thanks