Results 1 to 3 of 3

Thread: GL_TRIANGLES or GL_TRIANGLE_STRIP the Preferred Primitive?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2014

    GL_TRIANGLES or GL_TRIANGLE_STRIP the Preferred Primitive?

    I just spent way too much time finding and fixing a shading problem and now I have a question. Does the GL_TRIANGLE_STRIP have serious draw backs? When I first read about them I thought they seemed like a great idea; save a lot of space/time by using less vertices.

    Well, the GL_TRIANGLE_STRIP implies the triangles will be in a different order; which is the problem. All of the OPENGL books are using GL_TRIANGLES in their shaders I assume now to avoid the difficulty with the GL_TRIANGLE_STRIP in terms of consistency. Specifically, a
    GL_TRIANGLE_STRIP has the following order: v0v1v2, v0v2v3, ..., v0v(n-2)v(n-1). GL_TRIANGLES have the following order: v0v1v2, v3v4v5, ..., v0(n-3)v(n-2)v(n-1).

    This inconsistency causes issues in shaders while the consistency of TRIANGLES lends itself real well to fast programmable shader solutions. Of course, we could unravel the GL_TRIANGLE_STRIP inconsistencies in the shaders but doesn't that drawback make GL_TRIANGLES a better solution than GL_TRIANGLE_STRIP?

    I assume most will tell me it depends on the condition. However, since most of the books rely on GL_TRIANGLES and not GL_TRIANGLE_STRIP, does that mean they the preferred primitive?
    Any help is appreciated...

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Unindexed TRIANGLE_STRIPs, once in-vogue, yield lower performance than properly optimized indexed TRIANGLES. The reason is the work saved (vertex shader executions saved) due to proper use of the post-vertex shader vertex cache (formerly called the post T&L vertex cache).

    You can use either indexed TRIANGLES or indexed TRIANGLE_STRIPs to submit your triangles to the GPU, after you've optimized the triangle order. But consider unindexed TRIANGLE_STRIPs dead.

    For more details, see:

    * Strippers (Forsyth)
    * Vertex Cache Optimisation (Forsyth)
    * Regular mesh vertex cache ordering (Forsyth)
    * Optimal Grid Rendering (Castano)

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2014
    Thanks for the information; no wonder all the texts are using GL_TRIANGLES and index arrays.
    I'll read up.

Similar Threads

  1. Preferred toolkit?
    By AnteBios in forum OpenGL: General
    Replies: 1
    Last Post: 03-16-2004, 10:12 PM
  2. preferred extension loading library
    By mogumbo in forum OpenGL: General
    Replies: 4
    Last Post: 03-05-2004, 02:32 AM
    By jframosr in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-11-2003, 10:21 AM
  4. Replies: 3
    Last Post: 08-26-2003, 10:55 AM
  5. Preferred method for determining extension support (WIN32)...
    By Glossifah in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 01-27-2001, 12:15 PM

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