define gl_FragColor for macos

This commit is contained in:
Mitchell Hashimoto
2022-04-23 14:20:25 -07:00
parent c023fed8f0
commit d510d3c9a2

View File

@ -13,6 +13,9 @@ flat in vec2 screen_cell_pos;
// Position the fragment coordinate to the upper left
layout(origin_upper_left) in vec4 gl_FragCoord;
// Must declare this output for some versions of OpenGL.
layout(location = 0) out vec4 FragColor;
// Font texture
uniform sampler2D text;
@ -28,16 +31,16 @@ const uint MODE_CURSOR_RECT_HOLLOW = 4u;
void main() {
switch (mode) {
case MODE_BG:
gl_FragColor = color;
FragColor = color;
break;
case MODE_FG:
float a = texture(text, glyph_tex_coords).r;
gl_FragColor = vec4(color.rgb, color.a*a);
FragColor = vec4(color.rgb, color.a*a);
break;
case MODE_CURSOR_RECT:
gl_FragColor = color;
FragColor = color;
break;
case MODE_CURSOR_RECT_HOLLOW:
@ -46,7 +49,7 @@ void main() {
// rectangle so we take the slowdown for that one.
// Default to no color.
gl_FragColor = vec4(0., 0., 0., 0.);
FragColor = vec4(0., 0., 0., 0.);
// We subtracted one from cell size because our coordinates start at 0.
// So a width of 50 means max pixel of 49.
@ -70,7 +73,7 @@ void main() {
abs(cell_frag_coord.x - cell_size_coords.x) < eps ||
abs(cell_frag_coord.y) < eps ||
abs(cell_frag_coord.y - cell_size_coords.y) < eps) {
gl_FragColor = color;
FragColor = color;
}
}