On Dec 21, 2007 2:46 PM, Alexandre Quessy listes@sourcelibre.com wrote:
Hi,
2007/12/21, chris clepper cgclepper@gmail.com:
Please stop saying this. These features do work apart from reading
texture
coordinates from units other than zero.
Hmm, I have to dig a bit into this. Any example of a GLSL shader with mutlitexturing ?
Several have been posted to the list. But below is a very basic one:
varying vec2 texcoord1; varying vec2 texcoord2;
void main() {
texcoord1 = gl_MultiTexCoord0.st;
// texcoord2 = gl_MultiTexCoord1.st; // gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = ftransform();
}
uniform sampler2DRect MyTex; uniform sampler2DRect MyTex1;
varying vec2 texcoord1; varying vec2 texcoord2;
void main (void) {
vec4 color = texture2DRect(MyTex, texcoord1); vec4 color2 = texture2DRect(MyTex1, texcoord1); vec4 temp = color * color2; gl_FragColor = temp;
}
Obviously, this only works correctly if the textures are the same dimensions.