PDA

View Full Version : 2 Triangles vs Quad?



Skute
01-31-2003, 08:30 AM
Hi,

im doing a dissertation on opengl and direct3d programming and i wondered if anyone had an explanation as to why it is faster to render 2 triangles as a square, than it is to use 1 quad?

any links to technical items would be most grateful. ive had a look on google but nothing relavent was returned.

Won
01-31-2003, 08:36 AM
One possible reason may be that 4 vertices don't necessarily fall on the same plane or be in the correct winding order, and drivers may have to check for that to produce valid results. Quads that pass this check might get turned into triangles internally because the hardware is validated/tuned for triangles -- optimizing for the common case and all that... Naturally, the pre-triangulated version doesn't go through either of these steps.

There are other reasons to prefer triangles over quads as well because you have a better idea of what's going to happen to triangles after operations like clipping or vertex-interpolation of color etc.

-Won

Skute
01-31-2003, 09:28 AM
hmmm...yeah i see your point about converting a quad to a triangle, the triangle is the smallest base unit for drawing a surface isnt it, so drawing a quad is like a high level version of drawing 2 triangles,

Thanks for the quick responce,

pkaler
01-31-2003, 12:22 PM
Look up Bresenham's algorithm. You have to think about how per-vertex values are interpolated across a polygon. And then think about the geometric differences between quads and tris.

Coriolis
01-31-2003, 12:49 PM
A lot of equations that have exactly one solution with triangles could have 0 solutions with a quad. Basically, the linear equations describing every interpolated value (color, texture coordinates, position, etc) become over-specified if you have 4 constraints instead of 3. The only way you are guaranteed a solution is if at one of the corners is linearly dependent on the others.