Felix Kühling wrote:
On Fri, 15 Nov 2002 08:00:27 -0700
Brian Paul <[EMAIL PROTECTED]> wrote:


Felix Kühling wrote:
[...]

There's a bug in your program.  The GL light position is a homogeneous
coordinate (4 components) but you're only providing 3 components:

    GLfloat lightpos[3] = {0.0, 10.0, 0.0};

The 4th coordinate is effectively random.  Changing this to:

    GLfloat lightpos[4] = {0.0, 10.0, 0.0, 1.0};

Fixes the problem.

Ok, thanks. I read the manpage of glLight again and tried it with
different values for the fourth component. For 1.0 and 0.0 hardware and
software TCL seem to behave identically. For all other values their
behaviour differs somehow. As I don't know how to interpret values other
than 0.0 and 1.0 I can't tell which behaviour is "correct" (maybe
both?).
According to the OpenGL specification, the user-provided light position
is transformed by the current modelview matrix, just like a vertex.

After putting some debug code into Mesa, light position {0, 10, 0, 1}
is transformed to { 0.000000, 0.050437, -0.993759, 1.000000 } while
light position {0, 10, 0, 2} is transformed to { 0.000000, 0.050437,
-2.996257, 2.000000 }.

So clearly the light's transformed Z position depends on the W component
in this example so I'd expect this to effect the shading as we've seen.

However, I tried various non-zero values for W with NVIDIA's driver and
got different results.

On a hunch, I tried dividing the transformed light position's X, Y and Z
by W in Mesa.  After making this change, I get identical results to
NVIDIA's driver for any value of W.

But the spec doesn't say anything about dividing by W.  Also, looking at
the SGI sample implementation, I can't find a division by W either.

I may have to ask someone about this, but as far as I can tell, Mesa's
doing the right thing.

-Brian



-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing
your web site with SSL, click here to get a FREE TRIAL of a Thawte
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to