3 # From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special
6 # If a linked set of shaders forming the vertex stage contains no
7 # static write to gl_ClipVertex or gl_ClipDistance, but the
8 # application has requested clipping against user clip planes
9 # through the API, then the coordinate written to gl_Position is
10 # used for comparison against the user clip planes.
13 # - uses all 6 clip planes to clip a rectangle to a hexagon shape.
14 # - Multiplies all coordinates of gl_Position by 2 (including the
15 # homogeneous coordinate) to verify that homogeneity is properly
16 # accounted for in clipping.
25 gl_Position = 2.0 * gl_ModelViewProjectionMatrix * gl_Vertex;
32 gl_FragColor = vec4(1, 1, 1, 1);
36 clear color 0.0 0.0 0.0 0.0
39 clip plane 0 0 1 0 0.5
40 clip plane 1 -1 1 0 0.8
41 clip plane 2 -1 -1 0 0.8
42 clip plane 3 0 -1 0 0.5
43 clip plane 4 1 -1 0 0.8
44 clip plane 5 1 1 0 0.8
51 draw rect 0.1 0.1 0.8 0.8
53 # Test points inside each hexagon edge
54 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
55 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
56 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
57 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
58 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
59 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
61 # Test points outside each hexagon edge
62 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0)
63 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0)
64 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0)
65 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0)
66 relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0)
67 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0)