CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Location
    Bangalore, INDIA
    Posts
    45

    OpenGL Display List Problem

    Hello,

    I have a huge amount of lat lon data.. and i store them in maps (C++ std::map).. Now if i want to display all these points, it takes lot of time to display as the number of points are more ( somewhere around 22483 or something).

    Now once i load the data, then if i zoom in and out, again it takes some time, as the map is traversed again from beginning to end and displays all the points..

    Hence i want to optimize my displaying technique.. One thing what i came across is the use of Display List in opengl.. I used it and i got what i desired.. But i'm not able to select a particular point..

    In the main program i have a function called,
    Code:
    DisplayAllGLObjects(bool select)
    In this function the following code is written:

    Code:
    if(m_sctter_list)
        glCallList(m_scatter_list);
    else
    {
        m_scatter_list = glGenLists(1);
        glNewList( m_scatter_list, GL_COMPILE);
          // code: for loop to traverse the list of points and display
        for(std::map<unsigned int, EObjects *>::iterator it = scatterlist.begin(); it != scatterlist.end(); it++)
        {
           EObjects *ob = (*it).second;
           ob->DisplayGLObject(select);
        }
        glEndList();
    }
    Inside the loop the object will execute its display commands (glVertex3f() commands.)

    what change i have to do if i want to select an object and move it..?? i have written select function code.. I am using Render Mode as (GL_SELECT_MODE).. ANd using OpenGL technique to pick and object.. But since i started using Display lists, i'm unable to do so..

    Is there any other technique to optimize my display technique other then Display Lists..?? Or using the display lists itself my task can be achieved..??

    Thanks in advance..

  2. #2
    Join Date
    Oct 2006
    Posts
    616

    Re: OpenGL Display List Problem

    Create a separate Display List for each object.
    An object display list should probably be encapsulated by the object itself.

    Regards,
    Zachm

  3. #3
    Join Date
    Jul 2009
    Location
    Bangalore, INDIA
    Posts
    45

    Re: OpenGL Display List Problem

    Well,

    Actually, i had tried that option also.. But i failed to achieve what i wanted.. Secondly, i think even if i do it that way, the performance wont be improved.. it will remain same..

    What i want to do is, i want my application to read the x,y,z data from the file and display them onto the screen.. tHis display process must not take much time.. Here x,y are lat and long values and z is depth/elevation value.. Now once these set of points are displayed on the canvas, then, user must be able to select a particular point and change or modify the z-value of that individual point.. So once the point value is changed, then, we need to destroy the list and generate again the new one.. so it will again take time i guess..

    What is your opinion..??

    Thanks..

  4. #4
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    Re: OpenGL Display List Problem

    When picking (or selecting) individual vertices,
    each vertex in the picking list must have a
    naming value registered with OpenGL.
    Also you are limited to maybe 64 names.
    So you need algo that only names vertices near cursor.
    You can ditch the display lists and register vertex buffers for speed.
    Also you should use viewing frustum clipping to increase rendering speed.
    I think i would even use oct-tree if there was a considerable amount of mesh.
    Good luck...

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured