Skip to content

Instantly share code, notes, and snippets.

@rasteron
Last active August 29, 2015 14:27
Show Gist options
  • Save rasteron/caf516169e72984a58e9 to your computer and use it in GitHub Desktop.
Save rasteron/caf516169e72984a58e9 to your computer and use it in GitHub Desktop.
#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
#include "ScreenPos.glsl"
varying vec2 vScreenPos;
uniform float rt_w;
uniform float rt_h;
uniform sampler2D sceneTex;
#ifdef COMPILEPS
uniform float cVXOffset;
uniform float cPixelWidth;
uniform float cPixelHeight;
#endif
void VS()
{
mat4 modelMatrix = iModelMatrix;
vec3 worldPos = GetWorldPos(modelMatrix);
gl_Position = GetClipPos(worldPos);
vScreenPos = GetScreenPosPreDiv(gl_Position);
}
void PS()
{
vec2 uv = vScreenPos.xy;
vec3 tc = vec3(1.0, 0.0, 0.0);
if (uv.x < (cVXOffset-0.005))
{
float rt_w = 1.0 / 1366.0;
float rt_h = 1.0 / 768.0;
float dx = cPixelWidth*(rt_w);
float dy = cPixelHeight*(rt_h);
vec2 coord = vec2(dx*floor(uv.x/dx),
dy*floor(uv.y/dy));
tc = texture2D(sceneTex, coord).rgb;
}
else if (uv.x>=(cVXOffset+0.005))
{
tc = texture2D(sceneTex, uv).rgb;
}
gl_FragColor = vec4(tc, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment