~vanvugt/mir/frontend-server

« back to all changes in this revision

Viewing changes to examples/eglplasma.c

  • Committer: Daniel van Vugt
  • Date: 2014-03-06 03:18:55 UTC
  • mfrom: (1416.1.37 development-branch)
  • Revision ID: daniel.van.vugt@canonical.com-20140306031855-pjar7q2m3ghjwly5
MergeĀ latestĀ development-branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        "    const float pi2 = 6.283185308;                      \n"
86
86
        "    float u = texcoord.x * pi2;                         \n"
87
87
        "    float v = texcoord.y * pi2;                         \n"
88
 
        "    float t = mod(theta, pi2);                          \n"
89
 
        "    float us = (cos(1.1 * u + 7.0 * t) +                \n"
90
 
        "                cos(2.3 * v * cos(1.0 * t)) +           \n"
91
 
        "                cos(0.3 * u * cos(3.0 * t))             \n"
 
88
        "    float us = (cos(1.1 * u + 7.0 * theta) +            \n"
 
89
        "                cos(2.3 * v * cos(1.0 * theta)) +       \n"
 
90
        "                cos(0.3 * u * cos(3.0 * theta))         \n"
92
91
        "               ) / 3.0;                                 \n"
93
 
        "    float vs = (cos(2.3 * v + 8.0 * t) +                \n"
94
 
        "                cos(1.3 * u * cos(3.0 * t)) +           \n"
95
 
        "                cos(1.7 * v * cos(2.0 * t))             \n"
 
92
        "    float vs = (cos(2.3 * v + 8.0 * theta) +            \n"
 
93
        "                cos(1.3 * u * cos(3.0 * theta)) +       \n"
 
94
        "                cos(1.7 * v * cos(2.0 * theta))         \n"
96
95
        "               ) / 3.0;                                 \n"
97
96
        "    float x = (us * vs + 1.0) / 2.0;                    \n"
98
97
        "    gl_FragColor = vec4(gradient(x), 1.0);              \n"
105
104
        1.0f,-1.0f,
106
105
       -1.0f,-1.0f,
107
106
    };
 
107
    const float pi2 = 6.283185308f;
108
108
    GLuint vshader, fshader, prog;
109
109
    GLint linked, low_color, high_color, vpos, theta;
110
110
    unsigned int width = 0, height = 0;
151
151
    {
152
152
        glUniform1f(theta, angle);
153
153
        angle += 0.005f;
 
154
        if (angle > pi2)
 
155
            angle -= pi2;
154
156
        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
155
157
        mir_eglapp_swap_buffers();
156
158
    }