~vanvugt/mir/unique-id

« back to all changes in this revision

Viewing changes to examples/eglplasma.c

  • Committer: Daniel van Vugt
  • Date: 2013-04-16 06:59:13 UTC
  • mfrom: (578.1.12 trunk)
  • Revision ID: daniel.van.vugt@canonical.com-20130416065913-ihl399t0ud6t2uax
MergeĀ latestĀ lp:mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
        "uniform float theta;                                    \n"
65
65
        "varying vec2 texcoord;                                  \n"
66
66
        "uniform vec4 low_color, high_color;                     \n"
 
67
        "                                                        \n"
 
68
        "vec4 gradient(float x)                                  \n"
 
69
        "{                                                       \n"
 
70
        "    vec4 col;                                           \n"
 
71
        "    const vec4 white = vec4(1.0, 1.0, 1.0, 1.0);        \n"
 
72
        "    if (x < 0.333)                                      \n"
 
73
        "        col = x * low_color / 0.333;                    \n"
 
74
        "    else if (x < 0.666)                                 \n"
 
75
        "        col = (x - 0.333) * (high_color - low_color) /  \n"
 
76
        "              0.333 + low_color;                        \n"
 
77
        "    else                                                \n"
 
78
        "        col = (x - 0.666) * (white - high_color) /      \n"
 
79
        "              0.333 + high_color;                       \n"
 
80
        "    return col;                                         \n"
 
81
        "}                                                       \n"
 
82
        "                                                        \n"
67
83
        "void main()                                             \n"
68
84
        "{                                                       \n"
69
85
        "    const float pi2 = 6.283185308;                      \n"
79
95
        "                cos(1.7 * v * cos(2.0 * t))             \n"
80
96
        "               ) / 3.0;                                 \n"
81
97
        "    float x = (us * vs + 1.0) / 2.0;                    \n"
82
 
        "    gl_FragColor = x * (high_color - low_color) +       \n"
83
 
        "                   low_color;                           \n"
 
98
        "    gl_FragColor = gradient(x);                         \n"
84
99
        "}                                                       \n";
85
100
 
86
101
    const GLfloat vertices[] =