View Full Version : Manual bezier surface: GL_TRIANGLES or strips?

Phurtoman

07-23-2000, 12:15 PM

Okay, i'm generating a bezier surface and storing it as a mesh of vertices (not using OGL's curve evaluators). now, i'm just curious which would be faster. passing the entier list of vertices as GL_TRIANGLES to glDrawElements, or using strips. wouldn't the data structure for strips be a lot more convoluted? hrmm. anyone have the same issue?

lemino

-Phurt-o

Relic

07-23-2000, 10:25 PM

First, triangles require more vertices to be processed by the geometry pipeline, so depending on the number of vertices, triangle strips are about 3 times faster in geometry processing. (For example 102 vertices result in 34 independent triangles, but 100 triangles as a strip.)

The usual and simple way to render meshes is one strip for each row or column.

An advanced method would be to add some vertices for "null-triangles" (triangles which don't produce fragments) at the end of each strip to take a u-turn, fix the winding order and process the whole mesh with one single strip.

Agreed, sounds complicated http://www.opengl.org/discussion_boards/ubb/smile.gif, so I recommend the row-by-row approach. The inner vertices have to be issues twice in all cases, so it's just a question of calling overhead and code readability.

Reading the question once more, no, the order of vertices in a strip for one row of an N*M mesh is very straightforward. It's always: 1st vertex from nth row, 2nd vertex from nth + 1 row, and so on for the whole row.

[This message has been edited by Relic (edited 07-24-2000).]

Phurtoman

07-29-2000, 10:09 AM

Thanks, relic, that helps alot!

Now, what about other primitives, such as spheres, cones, cylinders, etc...

I guess cones and cylinders would be easy, too, now that I think about it, but what about spheres? I know there's a bunch of ways to tesselate the sphere, and i wrote two, one for the longitude/latitude method, and one for the more platonic subdivision, but they don't have a constant u and v for the triangle strips. Looking at it, it looks like it isn't all that hard, just a lot to keep track of. Anyone have any easy algorithms they would like to hit me with?

No code, please (I don't like plugging other people's work, but i don't mind a little help), just a breif explanation, maybe?

All help is greatly appreciated http://www.opengl.org/discussion_boards/ubb/smile.gif.

thx,

-Phurto

fenris

07-30-2000, 02:07 AM

For my bezier tesselator, I just take an extra step to actually create an array of vertex indices for each triangle, and just draw the thing using glDrawElements(). Vertex arrays are as fast if not faster than tri-strips correct?

I think if you do only one pass,there is no difference between glDrawElements() and GL_TRIANGLE_STRIP,the scond might even be faster....But in every modern 3d-engine youŽll do multiple passes on the same geometry and if you have your surfaces as vertex arrays you can use glLockArraysEXT and save alot of time.`Cause if you use glLockArraysEXT every vertex will only be transformed once....AND in most 3d-engines everything is drawn using glDrawElements() and it wouldnŽt be nice to draw the beziers with another code....

Greets,XBTC!

Relic

07-30-2000, 05:55 AM

>>>

but what about spheres? I know there's a bunch of ways to tesselate the sphere, and i wrote two, one for the longitude/latitude method, and one for the more platonic subdivision, but they don't have a constant u and v for the triangle strips.

<<<

The longitude/latitude method should have a constant number of subdivisions. If you change the longitude partitioning based on some area calculation from row to row, you'll get cracks between the row while drawing.

So, the longitude/latitude method is very common and useful for strips.

You might think the subdivision scheme looks perfect for independent triangles, but I actually built a paper icosaeder subdivided once (80 triangle faces) and it can be drawn in triangle strips diagonally running from pole to pole. http://www.opengl.org/discussion_boards/ubb/wink.gif Same for further subdivisions!

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.