glTexGen - no Texture Coordinate!

Hello,

i work on an Radeon 9800 with GLSL, and I’ve a problem with generated Texture Coordinates.
If I draw a Quad an gave it Texture Coordinates with glTexCroord3f I can map the Texture with the registrated sampler. If I remove the glTexCoord calls an use Texture Generation instead, i sea a gray plane, but I expect a Texture there.
If I deaktivate the Shader, the Mapping works fine.

In short:
Expilzit Texture Coords with Shader works
Generated Texture Coords without Shader works
Generated Texture Coords with Shader fails.

Here my Fragment Shader Code:

varying float LightIntensity;
uniform sampler2D tex;

void
main (void)
{
vec3 color = vec3(texture2D(tex, gl_TexCoord[0].st));
color = color * LightIntensity;
gl_FragColor = vec4(color,1.0);
}

In the VertexShader the only relevant call
for TexCoords is:
gl_TexCoord[0] = gl_MultiTexCoord0;

In my Programm I don’t forget to call glActiveTexture(GL_TEXTURE0) :slight_smile:

Thanks for any help.

Adler

Originally posted by Adler:
[b]Hello,

In short:
Expilzit Texture Coords with Shader works
Generated Texture Coords without Shader works
Generated Texture Coords with Shader fails.

Adler[/b]
Vertex Shaders REPLACE:

  • Vertex Transformation[]Normal Transformation (including rescale and normalize)[]TexCoord Generation and Transformation[*]…

Therefore, YOU, the shaderwriter, are responsible for providing the shader code to do TexCoord Generation and Transformation!
.
See Randi Rost’s book “OpenGL Shading Language,” Section 9.7 for shader code to do texcoord generation.
.
-mr. bill

Originally posted by mrbill:

Therefore, YOU, the shaderwriter, are responsible for providing the shader code to do TexCoord Generation and Transformation!
-mr. bill

Thanks a lot. I forgot this. I reread the Chapter.
But there is a nother Question. I’ve got a Plane with 32x32 vertecies, for example and a shader for this. If I’ve in the Vertex Shader this:

gl_TexCoord[0] = gl_MultiTexCoord0;

and I 'don’t use gl_TexCoord[0] in the Fragment Shader I’ve got something like a Ramp from high LightIntensity to low LightIntensity on the Plane. Why? Vendor spezific implementation behavoir?

Thanks for help!

Adler

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.