Visual C++ Design Question

I’m a beginner at OpenGL.
I have a question about implentation of OpenGL objects and data manipulation as it might pertain to the view/doc archetecture. I can’t decide weather to make the OpenGL engine and objects local to the view or doc archetecture. Or to seperate them. Does anybody have any suggestions? Thanks for any help you might suggest.

Hi !

What I am doing is putting every information about the world in the Document.
It does not make sense to put them in the View because ONE Document should be for ONE world.
This does not mean that the View shouldn’t have specific members (such as the rendering mode (filled/lines) or the state of the lights (on/off)) but the vertices/normals/maps should belong to the Document.
You can create a separated class (let’s say CModel) and put a member CModel *m_pModel in your Document but this is more or less the same (except that your CModel object can be used in another program more easily !).

Hope this will help you !

As far as I am concerned, I have used both methods for different programs.


The best way to deal with this sort of problem, is to figure out what information would need to be shared amongst several different views (CView derived objects), and make sure that this is contained in the CDoc.

Information about objects in the scene would be common to all views, so the neatest OOP way, is to create a load of objects (maybe in a tree structure) which are contained in the CDoc, so that any of the attached views can access this information when required.

Hope that this makes secnse.