Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GLUT OpenGl in multithreaded applications, it work?

181 views
Skip to first unread message

gff...@gmail.com

unread,
Jan 26, 2008, 4:03:12 AM1/26/08
to
I need to use GLUT OpenGl in multithreaded enviroments....and now I
can view an image and update it, but this cause problem with other
thread!!!!
I have a thread dedicated to Glut and I call this function:
glutDisplayFunc(drawInit);
glutIdleFunc(Display).

What I can do? help me, please!!!!!

jbwest

unread,
Jan 25, 2008, 11:24:44 AM1/25/08
to

<gff...@gmail.com> wrote in message
news:a1ab778a-a6c7-4988...@c4g2000hsg.googlegroups.com...

Make *all* your glut calls only from one (main! only!) thread. All other
threads must be compute-only worker threads. GLUT wasn't designed to be
thread-safe, it interacts with the window system so you must not in any
other thread, and multithreading OpenGL drawing is virtually never worth it.

in a word, don't do it.


francesc...@gmail.com

unread,
Jan 28, 2008, 1:10:00 PM1/28/08
to

unfortunate, I must use it!

Wolfgang Draxinger

unread,
Jan 28, 2008, 4:29:14 PM1/28/08
to
francesc...@gmail.com wrote:

> unfortunate, I must use it!

And GLUT is not thread safe, so you can't do it. Also OpenGL is
not meant to be used multithreaded. With some quirks you can
render to the same OpenGL context from multiple threads, even
simultanously, but within the OpenGL implementation a lot of
synchronization will be done, resulting in lower performance,
than rendering single threaded.

You can however do multithreaded rendering to separate contexts
on recent hardware (thinking of GeForce 8 series), quite well,
but's it's quite a mess to get right.

Anyway, you can't do it with GLUT, you have to use some thread
safe framework for this - or do it all yourself.

Wolfgang Draxinger
--
E-Mail address works, Jabber: hexa...@jabber.org, ICQ: 134682867

0 new messages