Author Topic: OpenGL Triangle Strips  (Read 7249 times)

0 Members and 1 Guest are viewing this topic.

Offline Xalthorn

  • Amiga 1200
  • ****
  • Posts: 331
  • Karma: 100
    • View Profile
OpenGL Triangle Strips
« on: March 31, 2010 »
Okay, so I have my little demo doing what I want it to do but now I want to do some heavy optimising.

It uses a significant number of triangles held in a big list and I figured the thing would run faster if I converted it to a few triangle strips.

However, having read through some websites, there seems to be a debate on whether or not this will make any difference whatsoever, and in fact it might run slower due to vertex cache issues.

As this is my first OpenGL project and I really don't have a clue, I'm hoping some of the experienced OpenGL'ers could let me know if it's worth wrestling with strips or just leave it as a triangle list.
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: OpenGL Triangle Strips
« Reply #1 on: March 31, 2010 »
If your application is limited by vertex-throughput use indexed triangle-lists with VBOs.
With strips you always pass one vertex per triangle.
With indexing you can get significantly lower (~0.5 vtx/tri) because all three vertices of a new triangle are still in the cache.
Challenge Trophies Won:

Offline Xalthorn

  • Amiga 1200
  • ****
  • Posts: 331
  • Karma: 100
    • View Profile
Re: OpenGL Triangle Strips
« Reply #2 on: March 31, 2010 »
If your application is limited by vertex-throughput use indexed triangle-lists with VBOs.
With strips you always pass one vertex per triangle.
With indexing you can get significantly lower (~0.5 vtx/tri) because all three vertices of a new triangle are still in the cache.

Umm, okay looks like I need to do some more reading.  I'll follow that link and have a read :)
Challenge Trophies Won:

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: OpenGL Triangle Strips
« Reply #3 on: April 01, 2010 »
This looks like a good resource for finding bottlenecks in your opengl apps:

http://www.opengl.org/resources/code/samples/advanced/advanced97/notes/node205.html
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: OpenGL Triangle Strips
« Reply #4 on: April 01, 2010 »
Quote
a significant number of triangles held in a big list
If "list" means a display-list you won't see much gain from VBOs.
The driver often performs quite some optimizations when assembling the list.
Challenge Trophies Won:

Offline Xalthorn

  • Amiga 1200
  • ****
  • Posts: 331
  • Karma: 100
    • View Profile
Re: OpenGL Triangle Strips
« Reply #5 on: April 01, 2010 »
Quote
a significant number of triangles held in a big list
If "list" means a display-list you won't see much gain from VBOs.
The driver often performs quite some optimizations when assembling the list.

Nope, my list is not as organised as that, it's just running through an array, spitting out OpenGL triangle commands as it goes.  I'm essentially writing a freebasic program throwing data at OpenGL and I'm sure OpenGL is annoyed at the way I'm doing it :)

But that gives me something else to think about, thanks :)
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: OpenGL Triangle Strips
« Reply #6 on: April 01, 2010 »
Are your vertices static or dynamic?
Challenge Trophies Won:

Offline Xalthorn

  • Amiga 1200
  • ****
  • Posts: 331
  • Karma: 100
    • View Profile
Re: OpenGL Triangle Strips
« Reply #7 on: April 01, 2010 »
Are your vertices static or dynamic?

Assuming you are asking if the vertices have the same local coordinates and not whether the vertice list changes, I have two large models, one is static (although the thing scales, but I can probably mess with the camera for that) and the other is extremely dynamic.

From initial looks, I'm guessing I can pop the static one in a display list for sheer speed as the thing never changes shape.  That should get me a huge speed increase, and I'm wondering if I pop the dynamic one into a display list I should be sending less information to the OpenGL pipeline each frame.
Challenge Trophies Won: