Commit e8fcb7d3 authored by Geequette's avatar Geequette

add shader #10 : distortion

parent cf40e924
......@@ -74,7 +74,7 @@ int main()
sf::Shader shader;
// if (!shader.loadFromFile("../../shaders/example_011.vert", "../../shaders/example_011.frag"))
if (!shader.loadFromFile("../../shaders/example_011.frag", sf::Shader::Fragment))
if (!shader.loadFromFile("../../shaders/example_010.frag", sf::Shader::Fragment))
{
std::cerr << "Error while shaders" << std::endl;
return -1;
......
......@@ -32,7 +32,8 @@ SOURCES += main.cpp
DISTFILES += \
../shaders/example_002.vert \
../shaders/example_012.frag \
../shaders/example_011.frag
../shaders/example_011.frag \
../shaders/example_010.frag
......
#version 120
uniform sampler2D currentTexture;
uniform float time;
void main() {
vec2 coord = gl_TexCoord[0].xy;
coord.x = coord.x/(0.5+0.2*cos(5*time));
coord.y += cos(radians(1500*time + coord.y * 0)) * 0.05*sin(time);
vec4 pixel_color = texture2D(currentTexture, coord);
gl_FragColor = pixel_color;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment