Does anybody have a simple example of using the GLSL_shader in the rendertree 
to sample textures on objects?

I'm using the GLSL_Shader with inputs from the OGL_Texture shader for the 
texture information.  I have specified the uniform names of the textures and 
call them in code by the same name, but apparently there are additional step(s) 
that must be take for the texture to be seen by the GLSL vertex and fragment 
shaders.

The details:
    - one polygon mesh
    - two texture projections, each with unique texture coordinates and image 
clip.
    - float parameter [0....1] to blend between texture 1 and texture 2.

In WebGL it would look something like this:

Vertex Shader:

    attribute vec2 aTexCoord1;
    attribute vec2 aTexCoord2;
    uniform sampler2D uSampler1;
    uniform sampler2D uSampler2;
    varying vec2 vTexCoord1;
    varying vec2 vTexCoord2;
    vec4 texColor1;
    vec4 texColor2;

    void main()
    {
        texColor1  = texture2D( uSampler1, aTexCoord1 );
        texColor2  = texture2D( uSampler2, aTexCoord2 );

        vTexCoord1 = aTexCoord1;
        vTexCoord2 = aTexCoord2;

        gl_Position = //vertex transformation code here
    }


Fragment Shader:

    varying vec2 vTexCoord1;
    varying vec2 vTexCoord2;
    uniform sampler2D uSampler1;
    uniform sampler2D uSampler2;
    uniform float t;
    vec4 texColor1;
    vec4 texColor2;

    void main()
    {
        texColor1 = texture2D( uSampler1, vTexCoord1 );
        texColor2 = texture2D( uSampler2, vTexCoord2 );

        gl_FragColor = ( texColor1 * t ) + ( texColor2 * (1.0 - t) );
    }



Thanks,

Matt


------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to