PDA

View Full Version : [Question] How I can compile displayList in other thread?



ceon
07-08-2005, 11:56 PM
I want to excute two threads.

First thread is for 'Render' of displayLists.
Second thread is for 'Compile' of displayLists.

I wish to move camera without delay of compiling displaylists made with objects received from networks.

I'm testing under Windows Environment...

Is it impossible?

OneSadCookie
07-09-2005, 02:33 AM
Make two contexts. Share textures/lists/etc between them. Make one context current in each thread.

knackered
07-10-2005, 04:26 AM
You should just have one render thread - that is, one thread that accesses opengl. There's no point in having two threads as the card can only do one user operation at a time. Having two threads, each with it's own context, will badly impact on performance because of the context switch, and will certainly not get rid of the DL compile delay...if one thread issues a draw command while the other thread is compiling a display list then the first thread will just have to wait.
There is an argument for having a second thread copying data into a mapped vertex buffer object, for instance, but that's the exception rather than the rule.
In your case, you should flag your meshes as needing a display list, and let the render thread decide when it's got enough time free in a frame to compile it.