PDA

View Full Version : Multitexturing



kiichle
05-26-2004, 11:35 AM
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?

jra101
05-26-2004, 11:48 AM
Are you specifying texture coordinates for both texture units using glMultiTexCoord?

Something like this:


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

kiichle
05-26-2004, 12:36 PM
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.

zed
05-30-2004, 07:26 PM
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, .. )