PDA

View Full Version : glCallList() probelem



sujan.dasmahapatra
11th November 2009, 08:16
Friends
This is an opengl question.
I am trying to call opengl items using
glCallList(index)
While i was creating many objects I was holding their indices in an array and while I am trying to display one at a time by calling
glCallList(index); passing the index.
But its displaying the most recent object created.
While the index value is correct but its not displaying previousobjects.

Can anyone help me undertsnad whats going on !
Any help would be appraciated.

Thanks
sujan

soxs060389
11th November 2009, 10:11
Give me some code and I "may" be able to help you.

JohannesMunk
11th November 2009, 15:03
Some code would be great, yes.

It sounds though, as your displaylist compilation is screwed up.

did you do it roughly along these lines:



Rendering:

int baseidx = glGenLists(itemcount);
for (int i=0;i < itemcount;++i)
{
glNewList(baseidx+i, GL_COMPILE);
// Render the item
glEndList();
}
...
Drawing:

for (int i=0;i < itemcount;++i)
{
glCallList(baseidx+i);
}
You can of course also generate the list for each item separately. But you would need to save each index then.

Cheers

Johannes