PDA

View Full Version : box triangle strip question



ugluk
08-18-2010, 11:27 AM
For the ARB_occlusion_query I need to render boxes fast. Now, rendering 12 triangles is easy, but this still means sending 3 * 12 = 36 vertices down the pipeline. Does any of you have a convenient triangle strip sequence of vertices to send? I know you only 12 + 2 = 14 vertices solution is possible. I tried to do it with pencil and paper but the optimal solution evades me, currently I am at 17 vertices.

kyle_
08-18-2010, 11:57 AM
Dont bother with strips, use indexed triangle list.
You than need to send only 8 vertices + 32 indices.
You could go down with this to 8v + 18i with quad strips i think.

You probably wont see any difference anyways.
You could also stash that into display list if you are still concerned.

ugluk
08-18-2010, 12:18 PM
Remember the tristrip cube = 8v + 14i, so it may lead to better performance when rendering a lot of them. Currently I am at 8v + 17i.

Display lists were thrown out with GL3 I think?

kyle_
08-18-2010, 12:44 PM
You cant get full cube with only 10 indices with strips, and i dont think you can do that with 12i either.

Nothing was actually thrown out of GL (and probabaly never will). Just create compatibility context and you can use them - do so if it makes sense for your case.

Also, measure what you do.
Im pretty certain your optimizations are a little pointless here ;)

ugluk
08-18-2010, 01:06 PM
Thanks for the help. Measurements don't mean much to me in this case, just peace of mind, that I have implemented the optimum.

After counting the indices again, I have 17 of them, out of possible 14. Sorry for the error ;)