Hi,

You just need load some two textures here is the code

osg::Program* program = new osg::Program;
        geometry->getOrCreateStateSet()->setAttribute(program);
        char vertexShaderSource[] = 
                                "varying vec2 texcoord;\n"
                                "\n"
                                "void main(void)\n"
                                "{\n"
                                "       gl_Position = ftransform();\n"
                                "       texcoord = gl_MultiTexCoord0.xy;\n"
                                "}\n";

        char fragmentShaderSource[] = 
                "uniform sampler2D baseTexture; \n"
                "varying vec2 texcoord;\n"
                "\n"
                "void main(void) \n"
                "{\n"
                                "       vec4 CHROMA_KEY = 
vec4(1.0,1.0,1.0,0.1);\n"
                                "       vec4 color = texture2D( baseTexture, 
texcoord); \n"
                                "       // ARUNA ROX I DID IT hahahaaaaa. THE 
BACKGROUND IN THE VIDEO IS NOT THAT COLOR\n"
                                "       if (color.y  > 0.5)\n"
                                "               discard;\n"
                "    gl_FragColor = color; \n"
                "}\n";

                program->addShader(new osg::Shader(osg::Shader::VERTEX, 
vertexShaderSource));
                program->addShader(new osg::Shader(osg::Shader::FRAGMENT, 
fragmentShaderSource));

here geometry is osg::Geometry pointer to which relative to the vedio


Thank you!

Cheers,
Aruna

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33161#33161





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to