Render to 4 Windows - Problem


I have to render to 4 different Windows in my programm! So I create a HGLRC for each Window.

If I had to render in the first Window I call

wglMakeCurrent(DC_of_first_window, HGLRC_for_first_window);

If I had to render in the second Window I call

wglMakeCurrent(DC_of_second_window, HGLRC_for_second_window);

and so on…

That works very well but every time I call
wglMakeCurrent(); I loose my textures!

I need the textures only in the first Window! So what can I do?

Try to share your textures between rendering contexts (if i remember well), or better, share one RC between windows… (less resources used, much faster rendering)

Are you passing the same DC every time? The textures should always be there for your first window in that case.

Look up wglShareLists on for the solution to this problem.


thanks for your answers!

“share one RC between windows…” Yes that would be the best Way but how?

Like this?:

wglMakeCurrent(dc_of_first_window, hRC);
// Render to first Window (no problems, all textures are OK)

wglMakeCurrent(dc_of_second_window, hRC);
// try to render to second window (no results)

The hRC was created for the first window’s dc and it works only with the first window’s dc!
But not with the dc of the second or third Window.

I hope someone can help me.

excuse my english.

You have to release to rc from the first windows dc before you can use it for the next window.
Release like this:-
wglMakeCurrent(dc_of_first_window, NULL);


“wglMakeCurrent(dc_of_first_window, NULL);”

I dont know why but that doesn’t work.

I dont get eny results in the other Windows, only in the first Window!

How can I Share only my textures between RC’s using wglShareLists(); Without creating Display Lists for all my Polygons?