/******************************************************************************* * * Description: * Sample GLSL FX file. * Takes 2 color sets in from the input data and does a blend based * on the "blend" uniform. * *******************************************************************************/ // We are using GLSL vs HLSL #pragma language GLSL uniform int blend; varying vec3 colorVector; varying vec3 colorVector1; void cpvShaderVertex() { // Position in screen space. gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; // pass texture coordinates as color vector colorVector = gl_MultiTexCoord1.xyz; colorVector1 = gl_MultiTexCoord2.xyz; } void cpvShaderPixel() { if (blend == 0) gl_FragColor = vec4( colorVector*colorVector1, 1.0); else if (blend == 1) gl_FragColor = vec4( (colorVector+colorVector1) / 2.0, 1.0); else if (blend == 2) gl_FragColor = vec4( (colorVector+colorVector1), 1.0); else if (blend == 3) gl_FragColor = vec4( (colorVector-colorVector1), 1.0); else if (blend == 4) gl_FragColor = vec4( colorVector, 1.0); else gl_FragColor = vec4( colorVector1, 1.0); } //////// techniques //////////////////////////// // Technique to display tangents technique cpvBlend { pass p0 { VertexShader = compile vs_2_0 cpvShaderVertex(); ZEnable = true; ZWriteEnable = true; ZFunc = LEqual; CullMode = None; PixelShader = compile ps_2_0 cpvShaderPixel(); } }