rendered paste bodyclass MyShaderCallBack : public video::IShaderConstantSetCallBack
{
public:
virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
{
services->getVideoDriver();
int c[] =
{
0,1
}
; // sampler2d IDs
services->setPixelShaderConstant("Texture0", (float*)&c[0], 1);
services->setPixelShaderConstant("Texture1", (float*)&c[1], 1);
}
};
/////////////vertex
varying vec2 texCoord;
void main(void)
{
gl_Position = vec4((gl_MultiTexCoord0.xy-0.5)*2,0,1);
// Texture coordinate for screen aligned (in correct range):
texCoord = gl_MultiTexCoord0;
}
/////pixel
uniform sampler2D Texture0;
uniform sampler2D Texture1;
varying vec2 texCoord;
void main(void)
{
vec4 tex = texture2D( Texture0, texCoord );
vec4 alpha = texture2D( Texture1, texCoord );
alpha.r= alpha.r + alpha.g +alpha.b;
gl_FragColor = (tex.rgb,alpha.r);
}