Files
libreoffice/vcl/opengl/replaceColorFragmentShader.glsl
Tomaž Vajngerl f3d26af515 opengl: add #version to shaders - minimum 130 which is OpenGL 3.0
Change-Id: I5710ce91e804641d4c997bc3d06970a5ed0cb5b1
Reviewed-on: https://gerrit.libreoffice.org/27890
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-08-05 08:02:28 +00:00

26 lines
804 B
GLSL

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 130
varying vec2 tex_coord;
uniform sampler2D sampler;
uniform vec4 search_color;
uniform vec4 replace_color;
uniform float epsilon;
void main() {
vec4 texel = texture2D(sampler, tex_coord);
vec4 diff = clamp(abs(texel - search_color) - epsilon, 0.0, 1.0);
float bump = max(0.0, 1.0 - ceil(diff.x + diff.y + diff.z));
gl_FragColor = texel + bump * (replace_color - search_color);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */