Question

I am trying to specify the glutClosefunc for the tutorial at http://www.glprogramming.com/red/index.html but it doesnt seem to work...

my code looks like this:

int main(int argc, char* argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(250,250);
    glutInitWindowPosition(100,100);
    glutCreateWindow("hello");
    init();
    glutDisplayFunc(display);
    glutCloseFunc(close);  //This isnt working
    glutMainLoop();
    return(0);
}

Its currently coming up with freeglut ERROR: function called without first calling 'glutInit'

The code example was a C example... i converted the parameters in main to C++, but i didnt change glutInit...

oh yeah, you can see i am using freeglut instead of glut like the tutorial says as well

Was it helpful?

Solution

Ahh I figured it out.. I had, in my linker input, linked to glut32.lib instead of freeglut.lib and therefore freeglut wasnt initializing properly!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top