Celeron's picture

[Shader Language] Compiler error on "texture2D"

Hello to all,
I'm really newbie for OpenGL & SL.. so I'm sorry if this post is trivial.
My goal is to reproduce the chapter #10 "Simple Texturing Example" of the "Orange Book".
When I compile fragment shader I got this error:

0(6) : error C1115: unable to find compatible overloaded function "texture2D(sampler2D, error)"

The fragment code that generates the compiler error is:

varying float LightIntensity;
uniform sampler2D EarthTexture;
 
void main()
{
	vec3 lightColor	= vec3(texture2D(EarthTexture, gl_TextCoord[0].st));
	gl_FragColor	= vec4(lightColor * LightIntensity, 1.0);
}

The graphic card is nVidia 8800 GT driver v. 7.15.11.8120 on Win Vista (VB.Net/Framework 2/OpenTK 0.9.3)

I'm sure the mistake is mine and I'm quite convinced that the problem is the way I set the uniform "EarthTexture".
To do this, I use this code just before the fragment compiling:

            Dim texLoc As Integer = GL.GetUniformLocation(programObject, "EarthTexture")
            GL.Uniform1(texLoc, 0)

Thanks for your attention.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Hey, it's:

gl_TexCoord[0].st

not

gl_TextCoord[0].st

Fix that and it should compile fine ;)

Celeron's picture

Oh my God.. shame on me :-( ... I think now it's the time to write shaders using "Render Monkey"; years of syntax highlighting have done their job and now I'm not able anymore to write code with notepad, I think... :-)

Thank you very much: now the shader is applied correctly and finally the "door to the understanding" was opened :-)