/// ============================================================================ /* Copyright (C) 2005 Robert Beckebans Please see the file "AUTHORS" for a list of contributors This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /// ============================================================================ uniform sampler2D u_ColorMap; uniform vec2 u_FBufScale; uniform vec2 u_NPotScale; const vec4 gloomStart = vec4(0.95,0.95,0.95,0.95); float sqr(float x) { return x*x; } vec4 sqr(vec4 x) { return x*x; } vec4 expand_luminance(vec4 color) { return color*(sqr(color.a*2.0)+1.0); } void main() { vec2 st00 = gl_FragCoord.st; // calculate the screen texcoord in the 0.0 to 1.0 range st00 *= u_FBufScale; // scale by the screen non-power-of-two-adjust st00 *= u_NPotScale; // calculate luminance vec4 color = texture2D(u_ColorMap, st00); gl_FragColor = expand_luminance(color)-gloomStart; }