Original Post
Ugh... i'm lost. My problem is getting a shader to listen to me! Here's the code:
//FRAG
uniform sampler2D keke0;
uniform sampler2D keke1;
void main (void)
{
vec2 src = vec2(gl_TexCoord[0]);
vec4 dest = texture2D( keke0, src);
vec2 src2 = vec2(gl_TexCoord[1]);
vec4 dest2 = texture2D( keke1, src);
// Draw texture 1
gl_FragColor = dest;
// Draw texture 2
//gl_FragColor = dest2;
}
//VERT
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord1;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
See, this code works great if I want to draw 1 texture. This always draws the last texture bound. Under no circumstances have I been able to get it to listen to me and utilize the second sampler2D I have there. I know how to pass uniform variables to the shader, however, when it comes to sampler2D's I don't know how to get it to work. Grr.. //uniformLocation String = "keke2"
ARBShaderObjects.glUniform1iARB(uniformLocation, textureID);
...
vec2 src2 = vec2(gl_TexCoord[1]);
vec4 dest2 = texture2D( keke1, src);
gl_FragColor = dest2; ...Doesn't work! Grr... GL13.glClientActiveTexture( GL13.GL_TEXTURE1);
GL11.glBindTexture( GL11.GL_TEXTURE_2D, sprite.getTextureID());
GL11.glEnable( GL11.GL_TEXTURE_2D);
ARBShaderObjects.glUniform1iARB(uniformLocation, 1);
...
vec2 src2 = vec2(gl_TexCoord[1]);
vec4 dest2 = texture2D( keke1, src);
gl_FragColor = dest2; ...Doesn't work either! As a side note: the GL11/GL13/ARBShaderObjects is from LWJGL, an OpenGL binding for Java. Ignore that if you arn't familliar with it. If you do, great, maybe I'm doing something wrong with that! [Edited by - Funkapotamus on December 7, 2004 8:07:48 PM]