Sign in to follow this  
jmberrueta

glGenLists returning 0

Recommended Posts

Hi, I'm having a problem when trying to call glGenLists(). I am trying to make a game... I have a class that loads models, and a model class. The model class has a make() method to be called after the object is created, in which I create the display list of the model with glNewList() and GL_COMPILE. The thing, as the subject says, is that when I call that method after creating the model, glGenLists(1) returns 0. The strange thing is that if I call the make() method of the model later on, the list id obtained is a valid one. I've browsed the web and found nothing about it. In most examples, the result of glGenLists is treated like the result of a malloc, which can be 0, but in most cases won't: so if glGenLists returns 0, the program just dies with an error. Thanks in advance. PS: I didn't post code so as to keep the thread simple, but I'd do it if you need it.

Share this post


Link to post
Share on other sites
The usual reason is that you're trying to call glGenLists before creating the OpenGL rendering context.

Share this post


Link to post
Share on other sites
glGenLists(1), I've never used this function, but glGen's that I use, usualy say glGen_something_(how many of them, pointer). To make sure this is the case, do a lookup for the functions parameters, cuz It might want a pointer, and passing one will definitely make it not work.

Share this post


Link to post
Share on other sites
Quote:
Original post by jmberrueta
I'm doing that after SDL_Init and SDL_SetVideoMode if that's what you mean.

Huh, weird. Post your code. Also, what does glGetError return afterwards?

Share this post


Link to post
Share on other sites
Nothing weird... you where totally right. While making smaller the code so as to post it, I realized I wasn't initializing the context though I thought I was (doh!).
Thank you very much Sneftel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this