[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] SWT-OpenGL rendering in different thread

Hi there,

at the moment I'm experimenting with the GLCanvas and asked myself why the access to the OpenGL context is so tightly restricted to the Display thread.
More precisely: I would like to do all the OpenGL rendering in a background thread without affecting the rest of the UI at all. Granted, it's usually a bad idea to mess around with OpenGL in multiple threads, but I was thinking about some kind of weighted execution queue that would allow me to render some views with higher priority than others and of course without blocking any kind of user interaction.

As a pure experiment I did this:
Extended the GLCanvas in my own project (boldly called this ExtGLCanvas) and just overrided the checkWidget() method by a weaker variant that only checks isDisposed. Then I simply handed all rendering stuff previously done via Display.asyncExecute() to a SingleThreadPoolExecutor.
At least with SWT OSX-Cocoa this seems to work like a charm.

So my question is: Am I missing an important point here?