4 corner gradient
akin at pobox.com
Thu Jun 28 10:46:29 PDT 2007
On Thu, Jun 28, 2007 at 11:29:04AM +0100, Keith Whitwell wrote:
| Glynn Clements wrote:
| > Tom De Man wrote:
| >> Using the i915 I try to create a 4 corner gradient rectangle using 2 3D
| >> primitive triangles. I get a visible diagonal line between the two
| >> triangles ...
| > Gouraud shading uses linear interpolation. Essentially, each of the
| > two triangles will be mapped to a planar (flat) triangle in RGB space.
| > As the 4 vertices (red, green, blue, white) aren't co-planar, there
| > will be a discontinuity (corner) along the diagonal where the two
| > triangles meet.
| > OTOH, bilinear interpolation between the vertices will produce a
| > continuous surface (specifically, a ruled surface) with no
| > discontinuities.
| > AFAIK, you cannot achieve bilinear interpolation using OpenGL
| > primitives...
I have a vague recollection that you can do this in old-style OpenGL
using texture mapping, but I can't find sample code at the moment.
| You could do it pretty simply with a pixel shader.
Yep, that would be the way to go with current hardware.
More information about the xorg