wglShareLists() with dummy window

Well, I tried appending this question to another topic, but that topic doesn’t seem to have been visited by anyone. So, I’ll have to start a new one, as I need an answer before I make fundamental changes to my engine:-

I need to create/destroy/create multiple windows, with multiple renderering contexts (win32).

Question:-
I’m thinking of having an invisible dummy window (say with a client area of 1x1) with a gl context, which holds all display lists and textures, while all other visible windows ‘share’ the dummy windows display lists and textures using wglShareLists().
Would this impact performance more than having all other windows share the first visible windows resources?

The reason I want to do it this way is that I want to be able to create and destroy all windows randomly at runtime, but keeping track of the context that ‘owns’ the resources would be a pain. That’s why I’m thinking an invisible window would be a neat solution.
Would this have any negative effects? Considering the dummy window/context will never be made current (except when creating textures/display lists) or be rendered to…

Also, in the MSDN spec for wglShareLists() it says that NO display lists should exist in the window that is sharing its resources at the time of the wglShareLists() call - does this still hold true?
And does this also apply to textures? (ie. no textures can exist in the sharing context before it shares its resources with another context).

Ok, ok - your silence speaks volumes - I should test it, you’re right.
It’s a hell of a lot of work, with my current architecture, but it would make the whole thing more elegant if it has no side-effects.
I shall let you know my conclusions, in the spirit of the forum.

No, there doesn’t seem to be any performance penalty for using a dummy window/context for textures and display lists.
In fact, it works rather nicely!

Hi
I want you to help me about using

wglShareLists()

I am creating a secondary thread from the main thread & creating my display lists in the secondary thread. The display lists are created nicely no problem but i can’t be able to call those lists from the main thread. I used the above function but it returns false. My secondary thread’s rendering context has the same pixel format as the main thread’s rendering context. but the function does not work.
Pls tell me some tutorials on this or send me the code where u used(if u can) so that i can have an idea of whats the problem with my implementation.Tell me ur email i shall contact u or ur msn id if u use msn messenger.See u
Thanks in advance.

Hi
I am using visual c++ 6.0(win32 API). My code sequence is like this

Secondary Thread
{
***Create a dummy window; create a rendering context for it with the same pixel format as the main thread’s rendering context.

***Make it current & call call
wglShareLists(RC_Main,RC_Thread)
for sharing the display lists among the main rendering context & the thread’s rendering context.
***Make the display List& set its status to ready.

}

Main Thread
{
***In WM_CREATE start the secondary thread
***Create Rendering Context
***Make it current
***Initilize openGL parameters like lighting etc
***in WM_TIMER
Call the drawing routine and call the display lists made in the secondary thread if its status is ready

}

Thats the main sequence or flow.

Hoping for a quick reply. Thanks

All my contexts are created in one thread.

I noticed from your psuedo-code that you seem to be calling wglShareLists() (in your secondary thread) before the main thread context is created. This won’t work.

Hi
When all my rendering contexts have been created then i call
wglShareLists(RC1,RC2);
but the function returns NULL.

The 2nd possibility that Its not working bqz i am creating the main rendering context in the main thread & the secondary rendering context in the secodary thread that can b true.

I try to make the two contexts in the main thread if it will not spoil my design. Tell me ur email or ur msn id if u use msn. It will b nice to share info with u.
Thanks very much .

Hi
My problem resolved thanks for the help

How did you resolve it?
…I’m curious.

hi
Tell me ur msn id then i shall tell u :stuck_out_tongue: hehehehehe okay

No man,
This will be really annoying for someone searching the archives looking for an answer to the same question.
So, pretty please with sugar on top, tell us how you solved your problem.

hi
I simply create the two contexts in the main thread. & called the sharing function from the same thread.
OKAY