PDA

View Full Version : OpenGL in a (Visual C++6) DLL



guille
03-15-2001, 06:54 AM
Hi, I'm using OpenGL in a win32-DLL (Visual C++6) to create a window and display some polygons. I'm not using the glMainLoop because I have my own loop to draw (I repaint the polygons in the WndProc of the OpenGL window that I have created - with CreateWindowEx -). The problem is that is painted.
My Draw routine does like this:

ClearGLScene();
...
glBegin(GL_POLYGON);
....
glVertex3d(x,y,z);
...
glEnd();
glFlush();

SwapBuffers(hDC);
...
I've done it before in a different DLL but I don't know why in this one doesn't work. Please, if you have any idea, tell me before I throw the PC out of the window...

Thanx all,
guille

Deiussum
03-15-2001, 09:32 AM
glMainLoop? You mean glutMainLoop? Obviously you wouldn't use that if you are creating the window yourself with CreateWindowEx. glutMainLoop is only going to work if you are using Glut to create the window. I assume you know that if you create it yourself you need to use SetPixelFormat, etc.? Also, I notice you are drawing with GL_POLYGONS... you only show one glVertex call, but I assume the ... means you have others in there as well. You need at least 3. With GL_POLYGONS you should also make sure that all the vertices are coplanar and that the polygon is convex. Concave polygons can lead to undefined results.

guille
03-20-2001, 05:18 AM
thankx... I think I didn't explain it clear... but anyway it was a problem of the viewpoint...
I create the window with CreateWindowEx and it works. Now I would like to know how can I make the objects rotate when I click and move the mouse at the same time in that window. I think I must handle it from my WndProc:
...
case WM_NCMOUSEMOVE :
{
...//the mouse has moved
break;
}
but I would like to know when the user has the left button clicked and the mouse moving... so then I can change the coord. to rotate and stuff like that. Thank you.