Quad color shading

hi

i want to render quad with color’s in the vertex, and to use smooth shading when fill the quad.

if for example i have

1.white--------2.black
| |
| |
| |
3.black--------4.white

i will get 2 difrent results if i render
1,2,4,3
or
2,4,3,1

how can i get true smoth shading over the quad?

thanks yuv

Well, if neither of the vertex orders provide the shading you want, then you must either change the geometry, or the shading pipeline itself, i.e. don’t use the standard one.

You may be able to get the shading you want by adding a vertex in the middle of the quad that has the desired color, and then drawing four triangles.

Most graphics hardware renders quads as a pair of triangles. The specific triangulation used by a device would be implementation-dependent.

You may well get completely different images in the opposite black/white case cited above – most scenes will not be that bad, however.

Quads must be planar for guaranteed results. ‘Planar’ does not limit itself to geometry, but to all attributes (color, fog coordinate, texture coordinates, whatever).

And you quad is not planar