More than 60K triangles per second?

I am using the following code , which is slightly modified from the Code::Blocks opengl default project. The problem Im having is that I cant get more than 1000 triangles without falling below 60 fps. I’m not sure what the triangles per second rating is, as radeon doesn’t specify for the 200, only 230 and up, but I’m sure 60K is very low. I think my VooDoo5 can do more than that. So I’m assuming I’m not optimizing the code right or something. please help :slight_smile:


glBegin(GL_TRIANGLES);

            
            for(int z = 0;z<1000    ;z++){
                //x = (rand() % 1000)/50 - 1.0f;
                //y = (rand() % 100)/50 - 1.0f;

                glColor3f(1.0f, 0.0f, 0.0f);   glVertex3f((float)(rand() % 1000)/500.0f - 1.0f,(float)(rand() % 1000)/500.0f - 1.0f,(float)(rand() % 1000)/500.0f - 1.0f);
                glColor3f(0.0f, 1.0f, 0.0f);   glVertex3f((float)(rand() % 1000)/500.0f - 1.0f,(float)(rand() % 1000)/500.0f - 1.0f,(float)(rand() % 1000)/500.0f - 1.0f);
                glColor3f(0.0f, 0.0f, 1.0f);   glVertex3f((float)(rand() % 1000)/500.0f - 1.0f,(float)(rand() % 1000)/500.0f - 1.0f,(float)(rand() % 1000)/500.0f - 1.0f);

                }//*/

            theta += 0.1f;
            glEnd();

Two things:

  1. glBegin/glEnd code is slow; it will never be able to achieve full triangle throughput.

  2. Triangle count isn’t the only arbiter of performance. Depending on the size of those triangles you may well end up being fillrate-bound. If you wish to measure triangle count in isolation then you should draw them as small as possible (or not draw them at all).

If you want performance, you should be using glDrawArrays/glDrawElements/etc with the data in VBOs.

Using glBegin/glEnd means half a dozen function calls per triangle. The GPU is spending 1% of its time actually working and the the other 99% waiting for the CPU to send it more data.

Cwhizard, once you rework your drawing to use glDraw* and VBOs, there’s lots more you can do if you still need more performance. The goal becomes minimizing the number of state changes and draw calls, and reducing the CPU time spent per draw. Lots of interesting techniques to learn here when you’re ready.

[QUOTE=mhagain;1287190]Two things:

  1. glBegin/glEnd code is slow; it will never be able to achieve full triangle throughput.

  2. Triangle count isn’t the only arbiter of performance. Depending on the size of those triangles you may well end up being fillrate-bound. If you wish to measure triangle count in isolation then you should draw them as small as possible (or not draw them at all).[/QUOTE]

Fillrate was an issue. making them smaller increased the TPS to 1.2M+. I tried to upload a screenshot, but all 3 methods, including posting a link, failed.


            for(int z = 0;z<20000    ;z++){
                float x = (float)(rand() % 1000)/600.0f - 0.9f;
                float y = (float)(rand() % 1000)/600.0f - 0.9f;

                glColor3f(1.0f, 0.0f, 0.0f);   glVertex3f(x,y,(x+y)/2.0f);
                glColor3f(0.0f, 1.0f, 0.0f);   glVertex3f(x+0.1f,y,(x+y)/2.0f);
                glColor3f(0.0f, 0.0f, 1.0f);   glVertex3f(x,y+0.1f,(x+y)/2.0f);

                }//*/

I’ve tried everything to post screenshots I could think of, including links to images uploaded to Imgur and Gyazo, with no luck.

The only thing that seems to work was uploading them to my web site. A link to those images displayed properly.

I’m interested in knowing of another way to post an image.

Just post the URL with a space or two in/after the http:// and we’ll fix up the link for you.

It is literally denying even posting the url if http is removed. So I dont know It’s still denying me. Here it is without the hypertext transport protocol thingy:

I think perhaps myu account may not have permissions?

Ok. I fixed up your URL for you above. Next time just put some spaces in the URL (and make a comment about removing the spaces).

Sorry for the inconvenience. For spam prevention, new users can’t post URLs until they have a certain small number of posts under-their-belt. It won’t be long and you should be able to post URLs.