PDA

View Full Version : Problem on OpenGL programming with VC++



aphlai
07-28-2001, 08:13 AM
I am using Visual C++ on Win Me. I tried a simple program like this
void renderpoly(void){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0.7,0.0);
glutWireTeapot(50);
glutSwapBuffers();
}

int WinMain .....
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutCreateWindow("Test undergoing");
glutDisplayFunc(renderpoly);

glClear is executed but the teaport is not seen, it is simply a blue window. Moreover, I would like to know when glutInitDisplayMode and glutCreateWindow is used, how I can set the window size???
BTW, thanks a lot

Leyder Dylan
07-28-2001, 08:15 AM
Have you placed the camera ?

Try "gluLookAt()".

Ex : gluLookAt(0,0,2,0,0,0,0,1,0);

FoxDie
07-28-2001, 10:00 AM
If you beginnig with OpenGL don't use
the glut.

ffish
07-28-2001, 06:45 PM
Originally posted by FoxDie:
If you beginnig with OpenGL don't use
the glut.

GLUT is ideal for beginning and for quick demos. nVidia uses it extensively for their demos. That way you can concentrate on OpenGL and not on Win32 or MFC programming. aphlai, the function you're looking for is glutInitWindowSize(int width, int height). You should be able to find some online documentation for GLUT somewhere (maybe search the discussion board for links). Otherwise, look at glut.h - it's fairly self-explanatory.

Hope that helps.