I’m implementing shaders with glsl in my JOGL applet. Everything works fine, except textures. If I try to access to texture 1 (With MultiTexture activated) , my program access to texture 0. I pass the unit of texture as a uniform to texture2D function. There is no way to say to my fragment shader which texture I need to view.
The fragment shader is very simple:
uniform sampler2D colorMap;
uniform sampler2D envMap;
void main()
{
vec4 color = texture2D(colorMap,gl_TexCoord[0].st);
vec4 env = texture2D(envMap,gl_TexCoord[1].st);
gl_FragColor=color+env*0.4;
}
It gets colorMap=0, envMap=0 . I believe this, because it applies as colorMap texture0 and as envMap texture0