Make anti-aliasing work with invert

This commit is contained in:
Theo Müller
2019-02-01 20:19:15 +01:00
parent 8cbf7bc579
commit 041bfdfd55
2 changed files with 24 additions and 4 deletions

View File

@@ -107,11 +107,9 @@ void render_side(in sampler1D tex, float idx) {
float s = get_line_height(tex, idx);
/* and finally set fragment color if we are in range */
#if INVERT > 0
float pos = float(screen.y) - gl_FragCoord.y;
#else
float pos = gl_FragCoord.y;
#endif
if (pos + 1.5 <= s) {
fragment = COLOR;
} else {

22
shaders/graph/4.frag Normal file
View File

@@ -0,0 +1,22 @@
in vec4 gl_FragCoord;
#request uniform "screen" screen
uniform ivec2 screen; /* screen dimensions */
#request uniform "prev" tex
uniform sampler2D tex; /* screen texture */
out vec4 fragment; /* output */
#include "@graph.glsl"
#include ":graph.glsl"
void main() {
float newy = gl_FragCoord.y;
#if INVERT > 0
newy = float(screen.y + 1) - newy;
#endif
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, newy), 0);
}