HLSL simple Texture Shader

Hello, i ve made a tutorial from my book. It creates me 2 simple texture shaders:

//Vertex Shader:
#version 110
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

//Pixel Shader:
#version 110
uniform sampler2D tex;
void main()
{
gl_FragColor = texture2D(tex, gl_TexCoord[0].st);
}

I am using Vertex Arrays and glDrawElements to display my stuff. But i just get it completely white shaded. Do i have to put something else in my Program than to activate the shader?

oh i have found my error. texture2d wasn t enabled :frowning:

You don’t have to enable texture2d. Check first if the shader is enabled! Try :
gl_FragColor = vec4(1.0,0.0,0.0,0.0); // red
If the the texture is visible, you are using the fixed pipeline!

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