Advertisement

triangle strips

Started by January 12, 2001 02:28 AM
6 comments, last by avianRR 24 years, 1 month ago
I''m trying to figure out triangle strips. I''m currently drawing the following two quads 1---2---3 | | | | | | 4---5---6 As 4 triangles ... 2,1,4 4,5,2 3,2,5 5,6,3 What I''d like to do is draw them as triangle strips but I''m haveing trouble getting them in the right order. If someone could tell me what the proper order for this would be I would be able to understand how there supposed to work.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
Here the order I use

2--4--6
|\ |\ |
| \| \|
1--3--5

just keep the odd vertices on the bottom and even on the top and you can draw a strip any lenght

Advertisement
triangle strip order is
0,1,2 - 2,1,3 - 2,3,4 - 4,3,5 etc

http://members.xoom.com/myBollux
Thanks, I got it working now!
For anyone that''s interested in the performance difference.
drawing a 128 x 128 grid as dual triangle quads
draw each triangle independantly = 7.5 fps
draw each quad as two triangles in a quad strip = 10.4 fps
draw each row as a strip of 128*2 triangles = 22.6 fps
I''ve qot 3 times the performance and the only changes were in the drawing calls (glColor, glVertex, and glNormal) Now to optomize some to the other code!
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
use vertex arrays and you''ll gain another ±50%

http://members.xoom.com/myBollux
I''ll have to try to find some info on those, do you know where there are any tutorials on vertex arrays? I optimized the calculations and removed approx 65000 multiplications per frame and I got no performance increese. I can only assume that the compiler was already implementing the same changes.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
Advertisement
maybe not you''ld be surprised how fast cpu''s r nowadays

http://members.xoom.com/myBollux
If the information I found is correct a pentiumII takes only 1-3 cycles to execute the fmul instruction. On my system that means I saved only 0.1% of the processors time.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]

This topic is closed to new replies.

Advertisement