PDA

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



jerin3D
01-31-2002, 05:06 AM
Hi,

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..?

Thanks,
Jerry

Eric
01-31-2002, 06:35 AM
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.

Regards.

Eric

lonzo
01-31-2002, 06:39 AM
also
check this out! http://www.gamedev.net/reference/programming/features/3dmfc/

lonzo
01-31-2002, 06:40 AM
Eric,

is using
glScissor and glViewport
good for this or not?
thanks

billy
01-31-2002, 06:57 AM
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. http://www.opengl.org/discussion_boards/ubb/frown.gif

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

Eric
01-31-2002, 07:09 AM
Originally posted by lonzo:
Eric,

is using
glScissor and glViewport
good for this or not?
thanks


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

Regards.

Eric

lonzo
01-31-2002, 08:26 AM
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

jerin3D
02-02-2002, 01:56 AM
Thanks a lot...

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