Fitz
02-15-2005, 02:15 PM
Hello I've been trying to access multiple textures within the fragment program, the problem is that when I use glUniform1iARB to bind a texture to any TU besides 0 it gives me error 1281 "Invalid Value". I use glGetUniformLocationARB to find the sampler2D position so I know the sampler position should not be what is generating this error, especially since I can bind the same position to TU0 and it works fine.
I'm using basically the exact methods shown in the Orange Book. I think there is something wrong with my C++ code because my computer should be able to do 4 textures and 16 texture image units. I downloaded a bump mapping GLSL demo from Nvidia and I was able to compile it and it works fine with 3 textures, they are using the same method to set up the shaders as I am. Is there some secret trick or bug to this?
This is all the fragment program does, textureUnit and textureUnit2 always use the same texture because I cannot get it to bind to any besides TU0.
uniform sampler2D textureUnit;
uniform sampler2D textureUnit2;
varying vec2 texCoord;
void main()
{
vec4 tempFrag2 = texture2D(textureUnit2,texCoord);
vec4 tempFrag = texture2D(textureUnit,texCoord);
gl_FragColor =mix(tempFrag,tempFrag2,0.5);
}
I'm using basically the exact methods shown in the Orange Book. I think there is something wrong with my C++ code because my computer should be able to do 4 textures and 16 texture image units. I downloaded a bump mapping GLSL demo from Nvidia and I was able to compile it and it works fine with 3 textures, they are using the same method to set up the shaders as I am. Is there some secret trick or bug to this?
This is all the fragment program does, textureUnit and textureUnit2 always use the same texture because I cannot get it to bind to any besides TU0.
uniform sampler2D textureUnit;
uniform sampler2D textureUnit2;
varying vec2 texCoord;
void main()
{
vec4 tempFrag2 = texture2D(textureUnit2,texCoord);
vec4 tempFrag = texture2D(textureUnit,texCoord);
gl_FragColor =mix(tempFrag,tempFrag2,0.5);
}