Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: doubt in glList

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    23

    doubt in glList

    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.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: doubt in glList

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    23

    Re: doubt in glList

    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.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: doubt in glList

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •