Hi
I'm trying to pass 2 textures to fragment shader. But in shader only one texture is avaible.
I found that problem is in glActiveTexture.
After call with any args, like glActiveTexture(GL_TEXTURE1), glActiveTexture(GL_TEXTURE2) .... i alway end in texture unit 0
here is part of code:
glActiveTexture(GL_TEXTURE0);
// debug
GLenum e = glGetError(); // e = 0
GLint nn;
glGetIntegerv(GL_ACTIVE_TEXTURE, &nn); // nn = GL_ACTIVE_TEXTURE = GL_TEXTURE0
glBindTexture(GL_TEXTURE_2D, leftEyeTextureHandle);
glActiveTexture(GL_TEXTURE1); // !!! <- it does not work
//debug
GLenum e = glGetError(); // e = 0
GLint nn;
glGetIntegerv(GL_ACTIVE_TEXTURE, &nn); // nn = GL_ACTIVE_TEXTURE = GL_TEXTURE0 !!!!!!
glBindTexture(GL_TEXTURE_2D, rightEyeTextureHandle);
I already cheacked:
- GL_EXTENSIONS for GL_ARB_multitexture
- tested "clean" example for multitexturing program and it work on same computer (GL_ACTIVE_TEXTURE gives GL_TEXTURE1 ...after glActiveTexture(GL_TEXTURE1));
- glActiveTextureARB
- GL_MAX_TEXTURE_IMAGE_UNITS = 20
- GL_MAX_TEXTURE_UNITS = 4
- tests on other computers (gfx ati / nvidia)
Problem is in opengl state but i can't figure where is problem.
Is there any "switch" to turn off multitexturing ?
fragment program:
#version 150
uniform sampler2D left;
uniform sampler2D right;
in vec2 UV;
out vec3 color;
void main(){
if (mod(trunc(gl_FragCoord.x), 2.0) < 0.5)
{
color = texture(left, UV);
} else {
color = texture(right, UV);
}
}