PDA

View Full Version : OpenGL without glut



snupinokyo
11-20-2003, 12:57 AM
I wrote a program presenting 3D objects in prespective projection. The program uses selection and feedback to allow the user to click & drag an objcet. Each object has its own display method, and build of some primitive objects. I wrote the program at VC++ 6.0 with glut. When two objects are intersecting each other, the program presents them one in the other, as it should be.

Now I have to translate the program to MFC, without glut. At the MFC version, When I presents the scene, using the same methods as at the without glut program, each object is displayed as in its own space. When two objects intersects one the other, they aren't displayed one peneterating the other's surface, but the object which its display method is called first is displayed in front of the other, even if they are defined on the same spot at the world coordinate.

I used the VC++ application wizard to build the interface, and the methods are the same as the program using glut, but instead of each call to glutPostRedisplay I call Invalidate, the same for glutMotionFunc and every other glut func.
The intersection of two objects is very important to my program, since I uses selection & feedback in order to calculate the object's intersection.
Please help me.

I think i must bypass the glut usage.
I guess the Coordinate of MFC (or Win32, this is the same) are different from the glut translated coordinats.

Thanx

mikael_aronsson
11-20-2003, 02:19 AM
As long as you setup the rendering context the same way in MFC as you did with glut there will not be any difference at all, the OpenGL rendering code is identical between glut and MFC.

Glut is just a platform independent layer ontop of the platform specific stuff to setup the window/mouse/keyboard and update handling.

So the actual output in the window will be the same in MFC as in glut as long as you havn't maessed up something in the translation.

Mikael