Using Display Lists in Multithreaded Application

Started by
1 comment, last by Metalcore 17 years, 5 months ago
I have an application with two threads, each having its own rendering context. One (first)thread prepares the data to be drawn in a display list, and when the data to be drawn is complete, it informs the other (second) thread. The second thread copies data from the display list created by the first thread into its own display list and renders it on to the screen.However this implementation causes an application crash after some time. Do anyone have an idea why?
Advertisement
The crash could be for any number of reasons and without some further information the reason for the crash can't be deduced. Have you run the code in a debugger and if so, where did the crash happen?
On a different note, copying the display list each frame from one thread to the other seems like a big overhead. Why not try copying pointers to display lists instead?

Skizz
If you have two contexts running on the same or compatible pixelformats, you normally use wglShareLists (or an equivalent function under other OSes) to unify the display list IDs (and all other OpenGL objects except occlusions) right after creation of the contexts, so that you can simply use the display list built in one context in the other. There's no need for a "copy", it's the same list.
If the pixelformats are not compatible (e.g. render_to_window and render_to_bitmap pixelformats often run on different OpenGL implementations), you cannot share any OpenGL context specific data among them via OpenGL. There you would need to create the display list in both contexts individually.

This topic is closed to new replies.

Advertisement