Jump to content
  • Advertisement
Sign in to follow this  
me_here_me

OpenGL diplaying a large data set in OpenGL

This topic is 2593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a large dataset of a building with 50,000 triangles and I have to display that using OpenGL. Currently I am doing the following:

1. Read the dataset in a linked list where every node is a triangle.
2. Then I display that linked list in the display method

I have two problems in this implementation
1. It is slow
2. All the triangles, i.e. 50,000 are being rendered again and again even when no change (like rotation of the dataset) has happened

So what can I do to:
speed up this implementation? (Are Display Lists the answer here?)
AND
reduce computation, so that an image is rendered only when there is a change in the screen.

thanks in advance for help

Share this post


Link to post
Share on other sites
Advertisement
A linked list is probably the worst storage container among the common containers, and drawing triangle by triangle is possibly the worst approach to drawing it, although triangle by triangle is possibly your only way given the linked list of triangles. A vertex array is your best option. Not only is it the most effective way (arguably display lists can match it), but it is also the preferred way in modern OpenGL. Display lists are out of the question if you want to stay with modern OpenGL.

That should solve your first concern. The second concern, however, is not related to how you store your object or how you draw it. You need to look into your window manager for that. Most window managers have a way, or works by the principle, of notifying you when you need to re-draw your window. So just respond to those events, and render only when you need to re-draw the window. For example, GLUT and the Windows API calls the redisplay callback, or sends the WM_PAINT message, when some part of the window has been invalidated and needs to be updated, so then is when you re-draw your object. I'm sure SDL also provides such notification, but the typical loop there, as well as with the Windows API which also provides this option, is to crunch messages and then re-draw the window immediately when everything is done. This is what you don't want to do if you don't want to re-draw your object over and over again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!