PDA

View Full Version : doubt in glList



pnpvivek
11-13-2009, 02:07 AM
Hi all,

I am having doubt in glList. can anyone solve this one?
Can I allocate the size for glList during runtime ?

ie.,
Initially i generate 2 List

base = glGenList(2);

circle = base ;
square = base + 1 ;
glNewList(circle ,GL_COMPILE);
DrawCircle();
glEndList();

glNewList(square ,GL_COMPILE);
DrawSquare();
glEndList();

then i delete these 2 list particular situation and then

i create new Lists and allocated its size may be 5 or more using glGenList(5) during runtime.

like ,

base = glGenList(5);

circle = base ;
square = base + 1 ;
rectangle = base + 2 ;
Oval = base + 3;
polygon = base + 4;
glNewList(circle ,GL_COMPILE);
DrawCircle();
glEndList();

glNewList(square ,GL_COMPILE);
DrawSquare();
glEndList();

glNewList(Rectangle,GL_COMPILE);
DrawRectangle();
glEndList();

glNewList(Oval,GL_COMPILE);
DrawOval();
glEndList();

glNewList(polygon ,GL_COMPILE)
Drawpolygon()
glEndList()


Is it possible to create and allocate size for the display List ?
can anyone suggests to me?
thnas in advance.

martinsm
11-13-2009, 04:06 AM
What do you mean by "size for display list"? When you call glGenList you specify number of how many display list id's to generate. After that you use those id's (n, n+1, n+2, ...) in glNewList function.

pnpvivek
11-14-2009, 03:25 AM
Hi martinsm,

Thanks for your reply.

What my problem is

I have two sets of display lists. One is static and another one will change dynamically.

In static i create two display lists using glGenList function and set the list base as zero by calling glListBase(0).

In dynamic size list i am calculating the list size based on user selection. for example during initial state it will be of size 10. During runtime user may change the list size. In that time i need to delete the lists and and create the list with new size using glGenLists(size) and assign the base using glListBase(0).

In this situation, my static lists are getting affected during the recreation of the dynamic lists with respect to the user selection.

If you found any mistake in my procedure let me know how to solve that issue.



Thanks in advance.

martinsm
11-14-2009, 09:35 AM
You don't need to delete old display lists to create new one's. Just call glGenLists function again to generate new lists and you can use them additionally together with previously created lists.