Timothy
Timothy

Reputation: 51

openGL glGenList Segmentation Fault on OSX

I am working with OpenGL and am having an issue using glGenLists. Every time I call it, I am getting a segfault. I wrote a simple program to test if it was the external libraries I was using, but discovered it was not. Here is the simple program:

#include "GLUT/glut.h"

int main(){
    GLuint list = glGenLists(1);
    return 0;
}

I am running this on Mac OS X 10.6.7 and am compile with:

g++ -framework OpenGL -framework GLUT -o test test.cpp

Any suggestions would be greatly appreciated

Upvotes: 5

Views: 1223

Answers (1)

Andrew Rasmussen
Andrew Rasmussen

Reputation: 15109

I believe, before using any OpenGL commands, you have to set up your OpenGL context.

There are a few things you have to do before you can just jump in and draw some triangles. You have to let the OS know that you need a window of x size with y properties, and that you're going to be drawing in it with OpenGL.

If you don't know how to set up your OpenGL context, you could try this. It could be old and a bit deprecated, but it'll work :)

Upvotes: 7

Related Questions