Skip to main content
gamedev.net
🔒 Locked

Multiple Rendering Contexts

Started by PGmeiner 2 replies 350+ views
Original Post
PGmeiner
PGmeiner
How can I use OpenGL for drawing with multiple Drawing-Windows. The problem is that i have multiple Static-Controls(MFC-App) which i use as Drawing-Windows. Now i want to draw in these multiple Static-Controls some Graphical things at the same time with OpenGL. Does anyone know how to provide this? thanks in advance Peter Gmeiner
Peter Gmeiner
Crispy
Crispy
It''s pretty easy. Just create each window (control) separately, create the respective HGLRC''s and before drawing call wglMakeCurrent() to capture the relevant rendering context. Then draw what you want and simply swap the buffers, and that''s it.

Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
PGmeiner
PGmeiner
yeah this runs!!
Thank you for the information i''m very glad that this is so easy.
Peter Gmeiner
Crispy
Crispy
Just one more thing: should you happen to destroy the window for some reason (e g you switch to fullscreen or windowed mode), you will have to reload all of the textures for each of the HGLRC''s separately. I don''t know of a way around this problem, other than attaching all of the HDC''s to the same RC, and calling different draw functions for each of the windows (which didn''t work for me when I tried it, although I did''n put my heart in it either). This is especially horrible if you have ''nested'' OpenGL windows (an OpenGL window as a child window on another OpenGL window) and you have to switch the parent window''s mode (resulting in destroying both the parent window and the child window(s)), so you''d have to reload all of the textures for each of the windows separately all over again. Let me know if you find a way around this...

Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.