PDA

View Full Version : OpenGL MDI in VC++



glguru
04-11-2000, 08:27 AM
Hi,
I am getting ready to start writing an MDI in VC++. I will be using OpenGL, so, I was looking on the web for a view class that has OpenGL enabled that I can subclass. I found an MDI on codeguru but some people commented that it has memory leaks. So, does anyone have or know of a site where I can get this information?

Thanks

flappy
04-13-2000, 10:21 PM
On www.codeproject.com (http://www.codeproject.com) there is a slightly more recent version of CGLEnabledView.
The leaks issue on codeguru were related to poor opengl drivers (old ATI ICD in that case) and infact all OpenGL application were affected.
Memory consumption is heavily connected to your video card ICD, for example on my GeForce I notice a 9 mb memory allocation upon startup and a ~1.5 mb allocation for each rendering context (that is view).

Alex

Eric
04-13-2000, 10:40 PM
Just a remark flappy : you can have only one rendering context per document i.e. you are not forced to have one RC per view.

Anyway, your 9mb must be due to the DC and not the RC... And as you need one DC per view, the result is the same...

Eric

glguru
04-14-2000, 06:50 AM
Thanks very much flappy and eric.
I am going to check it out. I hope it works.


glguru

flappy
04-19-2000, 11:28 PM
Hi Eric, you said:

Originally posted by Eric:
Just a remark flappy : you can have only one rendering context per document i.e. you are not forced to have one RC per view.

Anyway, your 9mb must be due to the DC and not the RC... And as you need one DC per view, the result is the same...

Eric

I've choosen to have a separate RC for each view for future expansions: I originally planned to design a multithreaded view class (there must be an RC for every thread), then I realized that multithreaded MDI interfaces are a real nightmare.
Perhaps in the future I'll try to move the RC handle into the Document class but I'm afraid this will introduce some state switching (by the way does someone knows if RC switching is slower or faster than state switching?).
Another way could be to share a single RC among all views.

Alex

Eric
04-20-2000, 01:03 AM
Hi Flappy.

That's waht I meant : I share one RC amongst all views... And the RC is contained within the document !

Eric

flappy
04-20-2000, 10:01 PM
Originally posted by Eric:
Hi Flappy.

That's waht I meant : I share one RC amongst all views... And the RC is contained within the document !

Eric

And how much memory does it consumes?
Which environment are you running in?

Just to check if I'm doing the bad way.

Alex