-
OpenGL hangs
I'm using Dev-C++ on Windows Vista with FreeGlut. I'm going through the OpenGL SuperBible and the first program just runs and then windows returns "xxxx.exe has stopped working."
The code looks like this but it happens with all the examples, not just this one.
Code:
/**************************
* Includes
*
**************************/
#include <gl/glu.h>
#include <gl/gl.h>
#include <gl/freeglut.h>
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Flush drawing commands
glFlush();
}
///////////////////////////////////////////////////////////
// Set up the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
///////////////////////////////////////////////////////////
// Main program entry point
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
return 0;
}
-
Is the message popping up before you see anything in the window or is it happening after you close the program? I'm not a OpenGL person, but it sort of sounds like a DevC++ problem. Try compiling it as a release version and open it outside of DevC++ and see what happens then. Or, better yet, go with a better IDE.
-
I tried just launching the executable outside of DevC++ and it tells me that the application could not be run because it cannot find glut.dll. I installed the freeglut package for DevC++. Is there something else that I need to do, also?
-
glut.dll should be in either the project directory or wherever you installed freeglut. Just copy it to where the executeable is. You can download it from the net if you google it, too.
I still reckon you should go with a different IDE. Cry code::blocks or, to make things much easier IMO, VS Express.
-
I tried wxwidgets once which I guess code::blocks is based on. Honestly, it confused the hell out of me and I didn't feel like any of the tutorials explained it very well.