I created and displyed a 3D object in the MDI application. But when i create more than one window in the same class then the message mapped to the view class is applied to all created windows.
ie; if rotate the object in one view,corresponding to this, object in the next view is also rotate. What is the reason for this.How avoid this problem ?
is using
glScissor and glViewport
good for this or not?
thanks[/b]
glViewport is needed, glScissor is not.
Basically, in the OnDraw member of your CView-derived class, you have to make the GL context actif (wglMakeCurrent), set your viewport (glViewport), projection matrix (glLoadIdentity + gluPerspective), modelview matrix (glLoadIdentity + XYZ) and then you can draw.
A lot of people create one rendering context per view, which I do not advise to do.
Usually, I have one rendering context per document and then all the views on this document share the context (but each of them obviously has its own DC).
Actually, if you are interested, I could try to build a little sample that shows how to use MFC, MDI Doc/View and OpenGL together (can’t do it before next week though…).