Is polygon creation with OpenGL slow?

I want to draw a lot of polygons on the screen, but I quickly notice that it slows down quickly. As a test, I did the following:

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();
}

It is only 50 polygons, and it is already slow. I cannot upload them directly to the card, because my program will allow the user to change the vertices.

My question is how can I speed this up. I do not use depth. I also know that these are not my GetCamera () functions, because if I create 500,000 polygons scattered in a subtle order, it just has problems displaying them in the view. If a graphics card can support 500,000,000 on screen polygons per second, should it be easy?

thank

+5
1
  • , glBegin glEnd ,

, , , . , - OpenGL.

(, 500kk) VBO ( Geometry Shaders, ). , - , , , VBO, .

( GL ) GL - , ( ) - - , , GPU ( ).

!

+14
source

All Articles