Results 1 to 10 of 10

Thread: More than 60K triangles per second?

  1. #1
    Newbie Newbie
    Join Date
    May 2017
    Posts
    5

    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

    Code :
    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();

  2. #2
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    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).

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,100
    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.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649
    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.

  5. #5
    Newbie Newbie
    Join Date
    May 2017
    Posts
    5
    Quote Originally Posted by mhagain View Post
    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).
    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.


    Code :
                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);
     
                    }//*/

  6. #6
    Member Contributor
    Join Date
    Jan 2017
    Posts
    54
    Quote Originally Posted by Cwhizard View Post
    I tried to upload a screenshot, but all 3 methods, including posting a link, failed.
    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.

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649
    Just post the URL with a space or two in/after the http:// and we'll fix up the link for you.

  8. #8
    Newbie Newbie
    Join Date
    May 2017
    Posts
    5
    Quote Originally Posted by Dark Photon View Post
    Just post the URL with a space or two in/after the *snip* 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:

    http://steamcommunity.com/sharedfile.../?id=932086498

  9. #9
    Newbie Newbie
    Join Date
    May 2017
    Posts
    5
    I think perhaps myu account may not have permissions?

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649
    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.

Similar Threads

  1. PN Triangles
    By NeXus in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 01-22-2004, 12:07 PM
  2. PN Triangles?
    By marcus256 in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 09-11-2003, 08:13 AM
  3. 30.000 triangles
    By jordiperez in forum OpenGL: Advanced Coding
    Replies: 22
    Last Post: 10-13-2002, 04:27 PM
  4. how many triangles at the most??
    By martinzwigl in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-28-2001, 02:42 AM
  5. Points or triangles?
    By qonjure in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-31-2001, 12:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean