display lists in another rendering context

Here’s the problem:
I have a rendering context RC1, created from device context (DC1), and compiled display lists in that one. Then, I’ve created compatible device context DC2 from DC1 and new rendering context RC2 from DC2. I want to call display lists in this new RC2, but it does not work. Why? Is this impossible or I’ve just done somthing wrong?

Thanks to all
and sorry for my english

Hi !

Each context has it’s own display lists, on windows you can use wglShareLists() to share lists between multiple rendering contexts, glx has a function like this too.


Thanks for advice!

But still it does not work. wglShareLists() return 0 (i.e. error) and the error code is 1 ( Incorrect function -ERROR_INVALID_FUNCTION)
Does it mean that I have a bad OpenGL driver or something else?

wglShareLists does not work between contexts using different OpenGL implementations, not even between different pixelformats running on the same implementation sometimes.

In MSDN’s words:
"You can only share display lists with rendering contexts within the same process. However, not all rendering contexts in a process can share display lists. Rendering contexts can share display lists only if they use the same implementation of OpenGL functions. All client rendering contexts of a given pixel format can always share display lists.

All rendering contexts of a shared display list must use an identical pixel format. Otherwise the results depend on the implementation of OpenGL used.

In your case it’s likely that your rendering context RC1 runs in hardware and the compatible device context DC2 (you want DRAW_TO_BITMAP?) spawns RC2 with MS GDI generaic OpenGL implementation. It’s impossible to share those.

yes, you’re right, I want DC2 and RC2 to render on mem bitmap (to save it into file then).
but here is what i’ve done:
-have forced DC1 for software mode (ChoosePixelFormat() didn’t want to choose pixel format i wanted, and i set it strictly, simply specifying pfd index I need in SetPixelFormat())
It works this way, but not good enough because only part of image is drawn.

Any ideas are appreciated
thanks in advance to all

again, sorry for my english