Hello,
Does anybody know how to detect in a GLSL script what multitexturing layers are used? I need it because some parts of my game use multitexturing and others don't. I thought it would work through a uniform, controlled by the main application, but it seems like it doesn't change the uniform in runtime, just when flipping the buffers.
Fragmentpart:
uniform sampler2D tex0,tex1;
// Some vars for later use
varying vec3 normal;
varying vec3 pos;
void main()
{
// What should be in the following condition to give back true, when
// multitexture-layer 1(the second) is active? How to detect this?
if(false) {
// Do something when multitexturing is on.
}else{
gl_FragColor = texture2D(tex0,gl_TexCoord[0].st) * gl_Color;
}
}
Vertexpart:
varying vec3 normal;
varying vec3 pos;
void main(void)
{
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = gl_Color;
normal = gl_NormalMatrix * gl_Normal;
pos = vec3(gl_Position);
}