View Full Version : Render to 4 Windows - Problem

12-25-2002, 01:30 AM

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?

12-25-2002, 11:35 AM
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)

12-25-2002, 11:48 AM
Are you passing the same DC every time? The textures should always be there for your first window in that case.

12-25-2002, 12:22 PM
Look up wglShareLists on http://msdn.microsoft.com/ for the solution to this problem.

12-28-2002, 12:14 AM

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.

12-28-2002, 01:23 AM
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);

12-29-2002, 07:26 AM

"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?