How to optimize display performance..??


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,

DisplayAllGLObjects(bool select)

In this function the following code is written:

    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;

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…

Use vertex buffers to store point data and display all of them with one draw call. This technique can handle millions of point primitives on any recent card.

Select mode is deprecated. It prevents almost all the optimization possibilities that you can use.

Well, thanks for the quick reply…

What my application does is that, it reads in a file which contains x,y,z data… x,y is lat, lon and z is the depth/elevation value… After reading in and displaying all those points, a user must be able to edit or modify this ‘z-value’ of an individual point… for this selection mode is important i guess…

So, the solution what you gave correctly fits the situation right now, i.e. to display values much faster… But editing (by selecting) also need to be done faster… Is it possible by vertex buffer…?? How about VBOs…?? They are combination of vertex buffer and display lists right…?? But i’m not sure of whether selection mode will work here or not…

Thanks again…

You have several options to perform picking these days, one is ray casting, another one is color picking. These are the only one I know, there may be some other techniques and I suggest you to google on this. So picking is not a problem no matter how you choose to represent your mesh data and which rendering technique you are using.

VBO are just vertex arrays that are managed efficiently in memory depending on the usage of the buffer. They are many good tutorials on vbo you can find on you favorite search engine.

In addition, I suggest you to look at functions like glMapBuffer and better glMapBufferRange, to update your vertex data. You can also use glBufferSubData if the update does not require a read back but it could be unefficient depending on how you arrange data in your buffer.

If you have huge vertex buffers for your terrain, you can split it it several squares and then determining which square the user is working on (after picking) then map the right one with glMapBufferRange.