root/OpenSceneGraph-Data/trunk/shaders/stereomatch_subtract.frag

Revision 8081 (checked in by robert, 9 months ago)

From Jose Delport, shaders for osgsterematch example

Line 
1 /* -*- Mode: C -*- */
2 uniform sampler2DRect textureLeft;
3 uniform sampler2DRect textureRight;
4 uniform int start_disparity;
5
6 void main(void)
7 {
8    vec2 texCoord = gl_TexCoord[0].xy;
9    vec4 final;
10
11    vec4 im0 = texture2DRect(textureLeft, texCoord);
12    
13    for (int t=0; t<4; t++) {
14        for (int c=0; c<4; c++) {
15            int disp_offset = (t*4)+c;
16            vec4 im1 = texture2DRect(textureRight, texCoord + vec2(-(disp_offset+start_disparity),0));
17            gl_FragData[t][c] = abs(im0 - im1);
18        }
19    }
20 }
Note: See TracBrowser for help on using the browser.