How can solve the message mapping problem in MDI appplication for more than one win?


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 ?

Any assingnment problem…?


The problem isn’t OpenGL but your understanding of the Document/View architecture.

If you want, you can e-mail me your program so that I can debug it.



check this out!


is using
glScissor and glViewport
good for this or not?

I also don’t understand the Document/View Architecture. I am used to VB.

When I create a new document I cannot change the old one.

I need to study this better. Does anyone know any good sites on this?

Oh ya, thanks Ionzo for that good site!

[This message has been edited by billy (edited 01-31-2002).]

Originally posted by lonzo:

is using
glScissor and glViewport
good for this or not?

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…).



Id like to see an example.

The link I posted is good,
but it get a little to
complex for me.

Another example would be great,
email me if you have the chance.
Thanks in advance TIA

Thanks a lot…

Yes the problem is the OpenGL DC assigining in the onDraw() function.Then code is worhing well