diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-03-20 12:58:22 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-05 16:47:37 +0200 |
commit | e48737ae778b8ef5e8e905825a2787b97deea23d (patch) | |
tree | 220628a632981dd709e801d2855e563989b39331 /examples/opengl/qopenglwindow/background.frag | |
parent | b53e08e3356528e7d240188c8985e205a6eaa2a2 (diff) |
Introduce QOpenGLWindow
[ChangeLog] Added QOpenGLWindow. This serves as a convenience class for
creating windows showing OpenGL content via an API similar to QGLWidget
and without any widget dependencies.
Done-with: Jorgen Lind <jorgen.lind@digia.com>
Task-number: QTBUG-36899
Change-Id: I52e9bc61acb129dbfd3841b3adeffab2dbcf7f05
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'examples/opengl/qopenglwindow/background.frag')
-rw-r--r-- | examples/opengl/qopenglwindow/background.frag | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/opengl/qopenglwindow/background.frag b/examples/opengl/qopenglwindow/background.frag new file mode 100644 index 0000000000..067c3505dc --- /dev/null +++ b/examples/opengl/qopenglwindow/background.frag @@ -0,0 +1,24 @@ +uniform highp int currentTime; +uniform highp vec2 windowSize; + +float noise(vec2 co) +{ + return 0.5 * fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453); +} + +float curvSpeed() +{ + return mod(float(currentTime), 1000000.0) / 500.0; +} + +float curv() +{ + return 1.0 - abs((gl_FragCoord.y / (windowSize.y / 10.0) - 5.0) - sin((gl_FragCoord.x / (windowSize.x/20.0)) - curvSpeed())); +} + +void main() +{ + float coordNoise = noise(gl_FragCoord.xy); + float proximity = smoothstep(0.5, 1.0, (curv() + 1.0) * (coordNoise )); + gl_FragColor = vec4(coordNoise, coordNoise, coordNoise, 1.0) * proximity; +} |