Hi Paul,
Or better yet:
gl_TexCoord[1] = texGen * gl_Vertex;
There is a lot of overlap between the object plane equations and the
texture matrix. Originally, the thinking behind the object plane
equations was that you might only be concerned with s and t, so it was
more efficient than using the texture matrix to do the transformation.
But if you're going to transform all four elements, you may as well do a
vector-matrix multiply.
Ok, thanks for the clarification. I kind of lifted the code from the
orange book without thinking too much :-)
Interesting. You should try debugging it by temporarily changing your
fragment shader to something like this:
gl_FragColor = gl_TexCoord[1];
This will color your object using s for red, t for green, etc., which
allows you to visually check to make sure the fragment shader is getting
good texture coordinate inputs. If the inputs are good, then it might be
an issue with texture binding. If the inputs are bad, then it could be
something wrong in the vertex shader or some incorrect usage of
predefined varyings.
I tried that already and the result is the same with my vertex shader
and with fixed-function vertex processing (and with your suggestion of
gl_TexCoord[1] = texGen * gl_Vertex; too). My texture bindings are good
too (I can use the sampler I want to use with gl_TexCoord[0] and see it).
So you confirm that the fixed function fragment stage will not do
anything special when texgen is active, i.e. that it will only do:
vec4 col = texture2D( tex, gl_TexCoord[1].st );
?
Personally, I don't use predefined varyings anymore, as they're
deprecated in v3.0 and not required in most of v2.x. Specifying my own
varyings makes it easier to swap between 2.x and 3.x. Plus there are a
zillion predefined varyings. I could never keep them straight, and it's
actually easier to define my own varying than look up what is the
correct one to use. Simply define this in both the vertex and fragment
shader:
varying vec4 tc;
and use it instead of gl_TexCoord[1].
I'll have to start using my own varyings too eventually. I'm just used
to using what's provided by whatever system I'm using before defining my
own, so that's why I use the predefined names for now.
Thanks for your help,
J-S
--
______________________________________________________
Jean-Sebastien Guay [email protected]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org