Multitexturing

I’m new to multi-texturing, so I may just be missing an init of some sort…

When I bind a texture to position 0, I can see/modify/use my texture in my fragment shader after setting the following in my vertex shader:

gl_TexCoord[0] = gl_MultiTexCoord0

and, if I use the same texture data and try to bind it to texture position 1 (after building a different texture first) I would expect to see it in a similar manner:

gl_TexCoord[1] = gl_MultiTexCoord1

but I can’t see my texture in this manner.

some background info: I am trying to use one image as texture0 and use a second texture map as a LUT to do window and leveling in the fragment shader.

But, it seems I can only see one texture at a time in the shader. Is it possible to use both gl_MultiTexCoord0 and gl_MultiTexCoord1 at the same time?

Are you specifying texture coordinates for both texture units using glMultiTexCoord?

Something like this:

glMultiTexCoord2f(GL_TEXTURE0, ...);
glMultiTexCoord2f(GL_TEXTURE1, ...);
glVertex3f(...);
etc...

Thank you for responding so quickly… yes, that’s what I’m doing.

But, when I pass into the fragment shader a sampler2D of the second texture and try to access it with texture2D it’s just gray, not the actual texture. The first texture (0) comes through fine.

youve gotta set the uniforms to get the textureID from your program into the shader.
sorry about being unspecific, but check the spec from memory use somehting like

int id = glGet…ID…( the_shader, “tex0” )
glSetUniform(…, id, … )

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