PDA

View Full Version : HRC and HDC,s



mariuss
02-18-2004, 07:54 AM
Env: Win 32 (windows 2000) opengl, devc++ (+mfc).
I have this 3d editor I'm working on it.
http://members.rogers.com/chisan7180
I'd like to add textures attached to some objects even for the 2D projecttion views. All 4 windows-views are created from the same window class. The class has CS_OWNDC style wich means they should share the HDC. <<ms help: CS_OWNDC Allocates one device context to be shared by all windows in the class>> but GetDC() for all 4 views returns different handler values, so the HRC's are different.
<<hrc = wglCreateContext(hDC);>>
When I create a texture <<glGen... ()>>
I get an unique texture id from openGL library. This id is unique per/current-selected HRC. I can select this texture id
and see it on the object
only if the HRC wich was selected in the DC when I've created the texture is again selectd in the DC (Drawing time).
Having this! in order to display a textured object in all 4 viewsI have to create
4 textures (for all 4 HRC's) and I don't kindof like it.
Do you know a better solution to this.
Thank you.

vmh5
02-18-2004, 10:18 AM
I've succesfully used two methods:

-pass the RC around and share it between the windows (i.e. call wglMakeCurrent(currentWindowDC, sharedRC))

-share bound textures & display lists between the different rc's using wglShareLists