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?
On 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).
Originally posted by Eric:
[b]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[/b]
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.