View Full Version : Multithreading with openGL displaylists
all of you, hope every one is okay. The problem is i wanna make a display list(with GL_COMPILE ) in one thread & call(display) it in some other theard.
But i can't be able to do that .
What am doing is creating a secondary thread thread from the main thread for display list creation & when the display list is completed i call it from the main thread. Butttt it does not work.
I checked that glGenLists(num of lists) does not return a valid value when used from the secondary thread.
Have any one got this problem too. Am sure some one must have faced this problem.
All suggestions are welcomed.
Bye take care all of you
03-15-2002, 09:51 AM
I'm assuming you're using Windows.
Go to http://msdn.microsoft.com/
Type in "wglShareLists" (without the quotes) in the search box and press enter.
Follow the first link.
03-15-2002, 11:18 AM
If I understand how OpenGL works under Windows correctly, the thread you create the rendering context in is the only one that can actually do OpenGL rendering calls.
yep am using windows.Can i do something like that
1) Create the main window rendering context
2) Create the secondary thread from the main thread
3)Create a button(as a child window of the main window) using CreateWindow("button",....) in the secondary thread procedure .
4)then i got the Device context for this button & bulid another rendering context for this button & make it current in the thread procedure.
5)After that i call wglShareLists(main_context,thread_context) & create my list in the secondary thread.
6)Then i can call the list created in the secondary thread from the main thread.
Did u people mean something like that???
Thanks for the replies.
03-17-2002, 03:14 PM
If I understand you correctly:
You have a main thread thats does the drawing and a 2nd thread that creates a display list.
Now where is the logic in that, no offense?
The main thread has to wait till the 2nd tread is finished anyway to draw it and needs to get notified either using an event or an critical section or worse a mutex (or has to wait until the thread terminates).
Even on a multiprocessor system you will not see a speed increase.
In order to get more speed on MP systems you send the main thread into a "WaitForMultipleObjects" sleep and launch as many (differend) displaylist creating threads as physical processors are available.
When one of the threads is done it simply signals the mainthread that a display list is ready and can be rendered.
I apologize to the "inner circle" for this OT post.
I am taking care of all that syncronization in multithreading. The problem is when i want to share lists among differenet rendering contexts
(one in the main thread & other in the secondary thread) with
it returns NULL mean failure.
thats it http://www.opengl.org/discussion_boards/ubb/smile.gif. Anybody pls help me out
No one there to help me out. Why u ppl r silent. Is it impossible to share display lists among Threads
[This message has been edited by immy (edited 03-20-2002).]
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.