File: coord_conventions.frag

package info (click to toggle)
glslang 16.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,712 kB
  • sloc: cpp: 92,305; yacc: 4,320; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (36 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#version 140

#extension GL_ARB_fragment_coord_conventions: require
#extension GL_ARB_explicit_attrib_location : enable

#ifdef GL_ES
precision mediump float;
#endif

in vec4 i;

layout (origin_upper_left,pixel_center_integer) in vec4 gl_FragCoord;
layout (location = 0) out vec4 myColor;

const float eps=0.001;

void main() 
{
    myColor = vec4(0.2);
    if (gl_FragCoord.y >= 10) {
        myColor.b = 0.8;
    }
    if (gl_FragCoord.y == trunc(gl_FragCoord.y)) {
        myColor.g = 0.8;
    }
    if (gl_FragCoord.x == trunc(gl_FragCoord.x)) {
        myColor.r = 0.8;
    }

    vec4 diff = gl_FragCoord - i;
    if (abs(diff.z)>eps) 
        myColor.b = 0.5;
    if (abs(diff.w)>eps) 
        myColor.a = 0.5;

}