Jump to content
  • Advertisement
Sign in to follow this  
Langecrew

OpenGL question about rendering efficiently

This topic is 4234 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

Hi everybody, In order to make sure I understand some openGL concepts and techniques, I wrote another small sample program. All it does is draw an axis system and plot a random list of 3D points, the number of which I have to choose. This little scene can also be rotated about the origin with the mouse. Nothing too heavy here. I notice, when I start rendering maybe 2000+ points, my performance seems to drag considerably. I used to do the following:
for i := 0 to list.count - 1 do
begin
  glBegin(GL_POINTS);
    glColor3f(List.data.X, List.data.Y, List.data.Z);
    glVertex3f(List.data.X, List.data.Y, List.data.Z);
  glEnd;
end; {for}
I switched the above loop so that glBegin and glEnd are only called once outside of the loop. This vastly improved the performance. Unfortunately, when I get around 6000 or 7000 points, the performance is still on the slow side. The rotation is no longer smooth enough to follow the mouse cursor. Just to make it clear, I'm not only looking to have a smooth rotation, I do realize I can simply perform translations to my "camera" coordinates instead of the whole point cloud...but I'm also looking to shave down that unholy load time that it takes to get the scene up in the first place. I was under the impression that OpenGL could be used to render rather large amounts of information quickly. Am I simply mistaken, or is there something else I need to do? Is it possible to do such a thing using OpenGL with EXTREMELY large amounts of data...just for kicks, let's say 100,000 or 1,000,000 data points? Thanks again, GameDev community -Langecrew-

Share this post


Link to post
Share on other sites
Advertisement
Look into different ways of sending the vertex data.

Such as:
DisplayLists
Vertex Buffer Objects

Your current method is resending all the vertex and color data from main memory to the graphics card EVERY frame.

With displaylists/vbos, the data is (optimally stored on the graphics card). So the data doesn't have to be resent every frame.

If you are new to OpenGL, try display lists first, they are IMHO easier to get to work for a beginner.

Hope that helps.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!