PDA

View Full Version : QGLShaderprogram, multiple textures



Mixpicles
21st May 2011, 12:21
Hello, I would like to hand in two textures to the QGLSP.


glBindTexture(GL_TEXTURE_2D,fbo_render->texture() );
edgeShader->setUniformValue("color_texture",0);
glBindTexture(GL_TEXTURE_2D, fbo_pick->texture());
edgeShader->setUniformValue("pick_texture",0);

Both textures are fine and can displayed seperately without problems.

My Fragmentshader:


uniform sampler2D color_texture;
uniform sampler2D pick_texture;

void main() {
// Set the output color of our current pixel
gl_FragColor = texture2D(color_texture, gl_TexCoord[0].st);
}

For a start I would like to access the textures in the shader seperately.

Unfortunately I can only access the last bound texture.

glActiveTexture wont work, due to some issues with glew. Unfortunately again, I dont have time to fix my glew problems.


My question is: how can I use the qt stuff to sucessfully adress both bound textures simultaneously.


I will be very gratefull for hints leading to the solution of my predicament.