Creating many polygons with OpenGL is slow?

Posted by user146780 on Stack Overflow See other posts from Stack Overflow or by user146780
Published on 2010-05-23T15:20:45Z Indexed on 2010/05/23 15:30 UTC
Read the original article Hit count: 229

Filed under:
|
|

I want to draw many polygons to the screen but i'm quickly noticing that it slows down quickly. As a test I did this:

for(int i = 0; i < 50; ++i)
{
        glBegin( GL_POLYGON);
        glColor3f( 0.0f, 1, 0.0f ); glVertex2f( 500.0 + frameGL.GetCameraX(), 0.0f + frameGL.GetCameraY());
        glColor3f( 0.0f, 1.0f, 0.0f ); glVertex2f( 900.0 + frameGL.GetCameraX(), 0.0f + frameGL.GetCameraY());
        glColor3f( 0.0f, 0.0f, 0.5 ); glVertex2f(900.0 + frameGL.GetCameraX(), 500.0f + frameGL.GetCameraY() + (150));
        glColor3f( 0.0f, 1.0f, 0.0f ); glVertex2f( 500 + frameGL.GetCameraX(), 500.0f + frameGL.GetCameraY());
        glColor3f( 1.0f, 1.0f, 0.0f ); glVertex2f( 300 + frameGL.GetCameraX(), 200.0f + frameGL.GetCameraY());
        glEnd();
}

This is only 50 polygons and already it's gtting slow. I can't upload them directly to the card because my program will allow the user to reshape the verticies.

My question is, how can I speed this up. I'm not using depth. I also know it's not my GetCamera() functions because if I create 500,000 polygons spread apart t's fine, it just has trouble showing them in the view. If a graphics card can support 500,000,000 on screen polygons per second, this should be easy right?

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about c