i did some experiments with threading and freeglut.
initialization and the creation of the windows with the main process and
call glutMainLoop with a thread is not working. the behaviour i quite funny.
if you create more than one window. the last window created is misbehaving.
it receives the display callbacks but the opengl commands seem to have no
effect. resizing one window causes effects on an other window.
this behaviour must not be related to freeglut and could have been cause by
A working option seems to be to call all glut/gl functions only from one
thread. also working is calling glutInit from the main process and creating
the window from the thread and calling glutMainLoop with the thread.
did somebody have more success?
is it caused through the opengl context? or can it be fixed in freeglut.
i tested on linux 2.6.11 fedora core 3. nvidia drivers 1.0-7174.
thanks and best regards
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
From: Sven Panne <Sven.P<anne@ae...> - 2006-01-19 21:47:10
Am Freitag, 6. Januar 2006 21:37 schrieb chganser@...:
> i did some experiments with threading and freeglut. [...]
> i tested on linux 2.6.11 fedora core 3. nvidia drivers 1.0-7174.
In OpenGL, there is no explicit passing of the current context, it is always
implicit and the context handling is outside of the scope of the OpenGL spec.
This design has been chosen for a very good reason: Context switching can be
extremely expensive. When you are using X11, the OpenGL contexts are managed
via GLX, and the GLX specs explicitly say that the current context is
thread-local. So what you are trying to do can't work by definition: How
shall GLUT know which thread will do the next OpenGL call and setup the
current context accordingly?
In general I would advise against doing graphics from multiple threads, most
graphic/UI libs can't handle this. More often than not, the need for doing
this is a strong hint for a bad design and leads to insanity... :-]
Get latest updates about Open Source Projects, Conferences and News.