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

Revision 6871 (checked in by robert, 2 years ago)

Checked in first cut of new SVN for OpenSceneGraph-Data

Line 
1
2 //
3 // screen.frag: Fragment shader for testing the "discard" command
4 // an example of an OpenGL Shading Language source file.
5 //
6 // author: Randi Rost
7 //
8 // Copyright (c) 2002: 3Dlabs, Inc.
9 //
10
11 // This file derived from the ogl2demo example in the 3Dlabs OpenGL2 SDK
12 // available from http://www.3dlabs.com/opengl2/
13 // Mike Weiblen 2003-07-14 : til osgGL2 implements the setting of uniforms,
14 // temporarily use consts instead.
15
16 varying vec3  Position;
17 varying float lightIntensity;
18
19 void main (void)
20 {
21     vec3        ct;
22     float       ss, tt;
23
24     vec3 pos = Position;
25    
26     ss = pos.x * 5.1;
27     tt = pos.z * 5.1;
28
29     ss = fract (ss);
30     tt = fract (tt);
31
32     if ((ss > 0.13) && (tt > 0.13)) discard;
33
34     ct = vec3 (0.9, 0.7, 0.25) * lightIntensity * 1.5;
35     ct = clamp(ct, 0.0, 1.0);
36
37     gl_FragColor = vec4 (ct, 1.0);
38 }
Note: See TracBrowser for help on using the browser.