Here is some of the code:
Vert shader:
Code: Select all
void main()
{
gl_TexCoord[0]=gl_MultiTexCoord0;
gl_Position = ftransform();
}
Code: Select all
uniform sampler2D tex; //Texture
uniform sampler2D tex1; //Lightmap?
void main()
{
vec4 texval1 = texture2D(tex, vec2(gl_TexCoord[0]));
vec4 texval2 = texture2D(tex1, vec2(gl_TexCoord[0]));
gl_FragColor = ((1-texval1)+texval2)*.5;
}
Code: Select all
class MyShaderCallBack : public video::IShaderConstantSetCallBack
{
public:
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
services->setPixelShaderConstant("tex1", reinterpret_cast<f32*>(1), 0);
}
};