Problems about multiThread in OpenGL

Started by
2 comments, last by Yann L 18 years, 5 months ago
currently I am programming multi-thread in openGL. the idea is to use another thread to issue glfinish() command and wait, until the gpu finishs drawing. but my program works very well when working serially, but when it runs in mutiple thread, or more specific, when I call glfinish() in another thread to wait for result, I always get " invalid operation" any hints for me ? Thanks.
Advertisement
Quote:Original post by brucile
but my program works very well when working serially, but when it runs in mutiple thread, or more specific, when I call glfinish() in another thread to wait for result, I always get " invalid operation"

Each thread needs its own dedicated context, or you have to make sure that only one thread accesses a single context at a time (by using appropriate mutexes). You can't just call GL commands from several threads simultaneously.
Why are you calling glFinish(), anyway?
Quote:Original post by Sneftel
Why are you calling glFinish(), anyway?

glFinish and glFlush are required in certain very specific situations when dealing with multithreaded OpenGL applications. The details are a little complex, but essentially it's about making the internal driver and GPU command stacks threadsafe.

But I don't think this is how the OT intended to use it ;)

This topic is closed to new replies.

Advertisement