PDA

View Full Version : Problem with glGenLists?



bunny-3110
07-26-2004, 04:28 AM
Hello,
this is my program :



scene.h
GLunit _model_init;
/*********/
scene.cpp
Scene::Scene()
{ _model_init=0;}
////////////
void Scene::loadModel(int id){
GLuint idModel;
idModel=id+1;
if (_model_init==0)
{
_model_init=glGenLists(1); // _model_init doesn't increase _model_init=0 all over the time ???
}
if (_model_init!=0) //'if' hasn't checked because _model_init value is always worth 0
{
glNewLists(idModel, GL_COMPILE);
(...); //there isn't glBegin() glEnd();
glEndLists();
}
}
////////////
void Scene::painGL(){
idStock=idModel;
glCallLists(idStock);}have you a solution for my problem, please?
thanks
Bunny

mikael_aronsson
07-26-2004, 05:16 AM
Hi !

glGenLists returns 0 when there is an error condition, check the error code with glGetErrror, but as you try to create the lists in the constructor a good guess is that you are calling glGenLists before you have selected any active rendering context, you must have a rendering context activated before you can call any OpenGL functions.

Mikael

bunny-3110
07-26-2004, 05:52 AM
thanks but
I try glGetErrror() and I have GL_NO_ERROR