Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: GL_TRIANGLE_STRIP vs. GL_TRIANGLES

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2003
    Posts
    10

    GL_TRIANGLE_STRIP vs. GL_TRIANGLES

    Hi people!
    I am going crazy! the following has no sense, but I can confirm is true: I have this code:

    for(i=0;i<this->lStripsD.num;i++) {
    glBegin(GL_TRIANGLE_STRIP);
    for (it = this->lStripsD[i].begin(); it != this->lStripsD[i].end(); ++it) {
    v=*it;
    x=this->lVerts[v].x; y=this->lVerts[v].y; z=this->lVerts[v].z;
    glVertex3f(x,y,z);
    }
    glEnd();
    }

    and another version with the same mesh but using GL_TRIANGLE draws it in less time...

    with GL_TRIANGLE_STRIP I send 7190 vertex with all the stripes, and with GL_TRIANGLES I send 17412 vertexs, how is it posible?


    Thansk for your help!!!

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Belgium
    Posts
    206

    Re: GL_TRIANGLE_STRIP vs. GL_TRIANGLES

    You're CPU limited because you're doing everything in immediate mode using glVertex(). Your triangle code is probably less CPU intensive than your triangle strip code, which explains the worse performance of the latter.

    I suggest you use display lists and/or vertex arrays. (and if you want to go even further, use vertex buffer objects).

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2003
    Posts
    10

    Re: GL_TRIANGLE_STRIP vs. GL_TRIANGLES

    with display lists the performance is worse, it is not applicable to my problem because the mesh changes dynamically...

    Anyway thanks a lot!
    F.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Belgium
    Posts
    206

    Re: GL_TRIANGLE_STRIP vs. GL_TRIANGLES

    Originally posted by jframosr:
    it is not applicable to my problem because the mesh changes dynamically...
    VBOs are *THE* answer then.
    But you should try simple vertex arrays first if you're not used to them yet, you should already get an impressive boost in performance with these anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •