Sign in to follow this  
hcl_hit

mult windows

Recommended Posts

hcl_hit    122
i searched on the net,but i dint found answer! my questiong is : just like two different ogl prog run on the screen'differnt place, how can i do these in one ogl prog. 3ks a lot!

Share this post


Link to post
Share on other sites
haegarr    7372
Several ways exist for that purpose, depending on what you want to yield.

(1) Drawing in several windows. Here you simply have to initialize not only one but several render targets. How to do so depends on the OS/API you are using. Furthurmore you have to decide whether or not the several windows should share the same OpenGL render context (that ist the thing you have to bind with the render target before doing any rendering). Sharing a context means that all participating windows are able to use the same textures, display lists, shaders, etc. Unshared contexts manage their own stuff, of course.

(2) Drawing in several window areas of the same window. Most OSes allow the render target not only to be a window but also to be a widget or the like. So you could create more than 1 render target per window. This is, of course, also OS/API depending. The stuff is mostly the same as told under (1).

(3) Drawing into several area parts of a single OpenGL area (e.g. drawing into several areas in a full screen mode). Here I mean that you got a larger area but restrict rendering to parts of it by yourself. For this purpose you have obviously to allocate only 1 render target (a window, widget, or full screen) and to bind to it. Then use glViewport and glScissor besides the usual GL matrices (perhaps the VIEW portion of the MODELVIEW matrix and the projection matrix).


Perhaps you want to tell us what exactly your desires are?

[Edited by - haegarr on April 18, 2006 5:47:10 AM]

Share this post


Link to post
Share on other sites
hcl_hit    122
thanks for your reply!and also sorry about confusing you!
my os is "windows xp",and all i want to do is just like the first topic in you article.Fortunately, I had solved my qusetion.
i had created 2 rc, and 2 window, each rc was binded to the dc(device context)which belongs to the window.My aim is :in the first window i render something (every 2m seconds excute once)(i use the timer fun:timeSetEvent()),the other window also rendering (also every 2m seconds carry out once).Of course the two window render different things.(just draw lines).I used double buffer.
but problem alse came.when my prog run, i cann't control my progam,such as i cann't push any button in my prog.
but i found my cpu is only beyond 20%,
i want to ask , the func swapbuffer(hdc) is The resources exhaust?


Share this post


Link to post
Share on other sites
bpoint    464
Rendering a frame for two windows every 2ms sounds a bit extreme, since 60fps is 16.6667ms. I would presume that it's not directly the CPU load, but Windows is unable to keep up with message processing along with all of the SwapBuffer calls.

First try lowering your redraw speed and see if that helps. If not, you might want to check to make sure you are still handling messages properly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this