glGenLists returning 0

Started by
4 comments, last by jmberrueta 16 years, 5 months ago
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.
Advertisement
The usual reason is that you're trying to call glGenLists before creating the OpenGL rendering context.
I'm doing that after SDL_Init and SDL_SetVideoMode if that's what you mean.
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.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

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?
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

This topic is closed to new replies.

Advertisement