Game Programming and Development Tools

Using OpenGL in MDI Application – ssquared

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
Does OpenGL maintain state per window or does it only maintain a single state? I know you can change context's using wglMakeCurrent, but what happens with lists and other state-related items?

This topic keeps coming up between my manager and me. Our application is MDI. We currently create and destroy the OpenGL context on each paint. As we examine ways of optimizing our OpenGL code, I keep mentioning how we need to maintain the OpenGL context using wglMakeCurrent. From his previous work on the code, he said there was a problem maintaining states between multiple windows and it required each window to run OpenGL on its own thread.

I thought someone here may have a definitive answer on this. Neither of us are OpenGL/3D gurus (I only just touched 3D...what...like two months ago? And my boss hasn't done extensive work with it either. We are both still learning.). We were just discussing this as an important issue and may end up being on our list of updates for our next release.

I've mentioned before, we have discussed the possibility of hiring a 3D expert to examine our code and optimize it. Someone who thinks like a 3D game developer and knows how we can, for example, view a city from various angles and allow movement in, around, and through the city. That last thing is just a possibility, but would be nice if the person understood this.

Briant

Member

Posts: 742
From: Stony Plain, Alberta, Canada
Registered: 01-20-2001
I remember reading about this exact issue a while ago, I hunt through my books. I'm pretty sure you're right about using wglMakeCurrent instead of destroying and recreating the render context (or else what would be the point of wglMakeCurrent in the first place?). I'll let you know if I find anything.

In the mean time, check out this, it may help:
http://www.codeproject.com/opengl/glenabledview.asp
and how to get it to compile in vc++ 2005:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=939858&SiteID=1

------------------
Brian

"OOP programmers have a lot of class"

Check out this webhost! Fantastic prices, features and support!

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
Excellent! Thanks.