Wikipedia:Reference desk/Archives/Computing/2008 May 4

= May 4 =

opengl program crash
hey I am a newbie at opengl programming in fact just started.. I got this program to compile under VS2008 but it crashes at glClear:-

i have included gl.h, glut.h and defined GLUT_DISABLE_ATEXIT_HACK it crashes at glutMainLoop while doing a callback to display. Commenting that line produces a crash at glFlush. I am using windows vista with ATI drivers. Bobatnet (talk) 12:12, 4 May 2008 (UTC)


 * It looks like all you need to do is swap the buffers. Opengl works by filling one buffer while the other is displayed and then switching them. So, your display method should look something like this:

If you forget to do this, your window won't display what you want, and it will look like it crashed. Leeboyge (talk) 23:54, 4 May 2008 (UTC)

Tried that but it still crashes. Actually, it stays on screen for some seconds and then it crashes. Also, the code is copied from the red book as I am just learning opengl. So, may be the code is right ?!! Bobatnet (talk) 04:47, 5 May 2008 (UTC)


 * That's really strange. I am assuming that it compiled correctly with no errors. If so, it may just be a Visual Studios thing. I am actually not using VS. I am using Cygwin to compile with gcc, and I am using the GLUT library directly. Here is all of the code I used to test yours:

I compiled with this:

This gives me a white square centered on a dark red background. If yours is crashing, I can only guess that it may be something to do with linking the libraries or with Visual Studio. You should have no problem running on XP or Vista. I am running on Vista right now, and it works just fine. Leeboyge (talk) 06:32, 5 May 2008 (UTC)