diff --git a/app/main.cpp b/app/main.cpp index 7e729216f..34ce118e4 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -190,9 +190,8 @@ int main(int argc, char *argv[]) // // https://bugreports.qt.io/browse/QTBUG-46140 QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); - format.setVersion(2, 0); + format.setVersion(3, 2); format.setProfile(QSurfaceFormat::CoreProfile); - format.setOption(QSurfaceFormat::DeprecatedFunctions); format.setDepthBufferSize(24); QSurfaceFormat::setDefaultFormat(format); diff --git a/app/node/distort/cornerpin/cornerpindistortnode.cpp b/app/node/distort/cornerpin/cornerpindistortnode.cpp index b14909fe7..4197f9649 100644 --- a/app/node/distort/cornerpin/cornerpindistortnode.cpp +++ b/app/node/distort/cornerpin/cornerpindistortnode.cpp @@ -97,18 +97,9 @@ void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g ShaderCode CornerPinDistortNode::GetShaderCode(const QString &shader_id) const { Q_UNUSED(shader_id) - QString frag = FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/cornerpin.frag")); - QString vert = FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/cornerpin.vert")); - // HACK: No good, very bad hack -#ifndef Q_OS_MAC - frag.prepend(QStringLiteral("#version 130\n\n")); - vert.prepend(QStringLiteral("#version 130\n\n")); -#else - vert.prepend(QStringLiteral("#extension GL_EXT_gpu_shader4 : require\n\n")); -#endif - - return ShaderCode(frag, vert); + return ShaderCode(FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/cornerpin.frag")), + FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/cornerpin.vert"))); } QPointF CornerPinDistortNode::ValueToPixel(int value, const NodeValueRow& row, const QVector2D &resolution) const diff --git a/app/node/math/math/mathbase.cpp b/app/node/math/math/mathbase.cpp index 7043b2f2f..3cdbdff4b 100644 --- a/app/node/math/math/mathbase.cpp +++ b/app/node/math/math/mathbase.cpp @@ -52,10 +52,10 @@ ShaderCode MathNodeBase::GetShaderCodeInternal(const QString &shader_id, const Q vert = QStringLiteral("uniform mat4 %1;\n" "\n" - "attribute vec4 a_position;\n" - "attribute vec2 a_texcoord;\n" + "in vec4 a_position;\n" + "in vec2 a_texcoord;\n" "\n" - "varying vec2 ove_texcoord;\n" + "out vec2 ove_texcoord;\n" "\n" "void main() {\n" " gl_Position = %1 * a_position;\n" @@ -97,12 +97,13 @@ ShaderCode MathNodeBase::GetShaderCodeInternal(const QString &shader_id, const Q frag = QStringLiteral("uniform %1 %3;\n" "uniform %2 %4;\n" "\n" - "varying vec2 ove_texcoord;\n" + "in vec2 ove_texcoord;\n" + "out vec4 frag_color;\n" "\n" "void main(void) {\n" " vec4 c = %5;\n" " c.a = clamp(c.a, 0.0, 1.0);\n" // Ensure alpha is between 0.0 and 1.0 - " gl_FragColor = c;\n" + " frag_color = c;\n" "}\n").arg(GetShaderUniformType(type_a), GetShaderUniformType(type_b), param_a_in, diff --git a/app/render/opengl/openglrenderer.cpp b/app/render/opengl/openglrenderer.cpp index 49f8d3c89..6464580cf 100644 --- a/app/render/opengl/openglrenderer.cpp +++ b/app/render/opengl/openglrenderer.cpp @@ -887,14 +887,9 @@ GLuint OpenGLRenderer::GetCachedTexture(int width, int height, int depth, VideoP GLuint OpenGLRenderer::CompileShader(GLenum type, const QString &code) { static const QString shader_preamble = -#ifndef Q_OS_MAC - // Use appropriate GL ES 2.0 shader header - QStringLiteral("#version 100\n\n" + // Use appropriate GL 3.2 shader header + QStringLiteral("#version 150\n\n" "precision highp float;\n\n"); -#else - // Use desktop GL equivalent header because apparently macOS doesn't support the ES header - QStringLiteral("#version 120\n\n"); -#endif QString complete_code; diff --git a/app/render/renderer.cpp b/app/render/renderer.cpp index a3701c2ff..b78df3df4 100644 --- a/app/render/renderer.cpp +++ b/app/render/renderer.cpp @@ -116,7 +116,7 @@ bool Renderer::GetColorContext(ColorProcessorPtr color_processor, Renderer::Colo // Create shader description const char* ocio_func_name = "OCIODisplay"; auto shader_desc = OCIO::GpuShaderDesc::CreateShaderDesc(); - shader_desc->setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_3); + shader_desc->setLanguage(OCIO::GPU_LANGUAGE_GLSL_ES_3_0); shader_desc->setFunctionName(ocio_func_name); shader_desc->setResourcePrefix("ocio_"); diff --git a/app/shaders/alphaover.frag b/app/shaders/alphaover.frag index 58c4be721..45acd2cfa 100644 --- a/app/shaders/alphaover.frag +++ b/app/shaders/alphaover.frag @@ -3,29 +3,30 @@ uniform sampler2D blend_in; uniform bool base_in_enabled; uniform bool blend_in_enabled; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { - vec4 base_col = texture2D(base_in, ove_texcoord); - vec4 blend_col = texture2D(blend_in, ove_texcoord); + vec4 base_col = texture(base_in, ove_texcoord); + vec4 blend_col = texture(blend_in, ove_texcoord); if (!base_in_enabled && !blend_in_enabled) { - gl_FragColor = vec4(0.0); + frag_color = vec4(0.0); return; } if (!base_in_enabled) { - gl_FragColor = blend_col; + frag_color = blend_col; return; } if (!blend_in_enabled) { - gl_FragColor = base_col; + frag_color = base_col; return; } base_col *= 1.0 - blend_col.a; base_col += blend_col; - gl_FragColor = base_col; + frag_color = base_col; } diff --git a/app/shaders/blur.frag b/app/shaders/blur.frag index fb60660f0..319ed8ea0 100644 --- a/app/shaders/blur.frag +++ b/app/shaders/blur.frag @@ -8,7 +8,8 @@ uniform vec2 resolution_in; uniform int ove_iteration; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; // Gaussian function uses PI #define M_PI 3.1415926535897932384626433832795 @@ -63,7 +64,7 @@ void main(void) { int mode = determine_mode(); if (mode == MODE_NONE) { - gl_FragColor = texture2D(tex_in, ove_texcoord); + frag_color = texture2D(tex_in, ove_texcoord); return; } @@ -119,5 +120,5 @@ void main(void) { } } - gl_FragColor = composite; + frag_color = composite; } diff --git a/app/shaders/colormanage.frag b/app/shaders/colormanage.frag index 55b394eed..dc0be4a45 100644 --- a/app/shaders/colormanage.frag +++ b/app/shaders/colormanage.frag @@ -10,7 +10,8 @@ uniform mat4 ove_cropmatrix; #define ALPHA_ASSOC 2 // Main texture coordinate -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; // Program will replace this with OCIO's auto-generated shader code %1 @@ -31,7 +32,7 @@ vec4 deassoc(vec4 c) { void main() { vec2 cropped_coord = (vec4(ove_texcoord-vec2(0.5, 0.5), 0.0, 1.0)*ove_cropmatrix).xy + vec2(0.5, 0.5); if (cropped_coord.x < 0.0 || cropped_coord.x >= 1.0 || cropped_coord.y < 0.0 || cropped_coord.y >= 1.0) { - gl_FragColor = vec4(0.0); + frag_color = vec4(0.0); return; } @@ -52,5 +53,5 @@ void main() { col = assoc(col); } - gl_FragColor = col; + frag_color = col; } diff --git a/app/shaders/cornerpin.frag b/app/shaders/cornerpin.frag index 7dd7e3306..ce688b669 100644 --- a/app/shaders/cornerpin.frag +++ b/app/shaders/cornerpin.frag @@ -4,45 +4,46 @@ uniform sampler2D tex_in; uniform bool perspective_in; // Input texture coordinate -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; -varying vec2 q; -varying vec2 b1; -varying vec2 b2; -varying vec2 b3; +in vec2 q; +in vec2 b1; +in vec2 b2; +in vec2 b3; float Wedge2D(vec2 v, vec2 w) { - return (v.x*w.y) - (v.y*w.x); + return (v.x*w.y) - (v.y*w.x); } void main() { if(perspective_in){ - gl_FragColor = texture2D(tex_in, ove_texcoord); + frag_color = texture2D(tex_in, ove_texcoord); } else { - float A = Wedge2D(b2, b3); - float B = Wedge2D(b3, q) - Wedge2D(b1, b2); - float C = Wedge2D(b1, q); + float A = Wedge2D(b2, b3); + float B = Wedge2D(b3, q) - Wedge2D(b1, b2); + float C = Wedge2D(b1, q); - vec2 uv; + vec2 uv; - // solve for v - if (abs(A) < 0.001) { - uv.y = -C/B; - } else { - float discrim = B*B - 4.0*A*C; - uv.y = 0.5 * (-B + sqrt(discrim)) / A; - } + // solve for v + if (abs(A) < 0.001) { + uv.y = -C/B; + } else { + float discrim = B*B - 4.0*A*C; + uv.y = 0.5 * (-B + sqrt(discrim)) / A; + } - // solve for u - vec2 denom = b1 + uv.y * b3; - if (abs(denom.x) > abs(denom.y)) { - uv.x = (q.x - b2.x * uv.y) / denom.x; - } else { - uv.x = (q.y - b2.y * uv.y) / denom.y; - } + // solve for u + vec2 denom = b1 + uv.y * b3; + if (abs(denom.x) > abs(denom.y)) { + uv.x = (q.x - b2.x * uv.y) / denom.x; + } else { + uv.x = (q.y - b2.y * uv.y) / denom.y; + } - uv.y = 1.0 - uv.y; + uv.y = 1.0 - uv.y; - gl_FragColor = texture2D(tex_in, uv); - } + frag_color = texture2D(tex_in, uv); + } } diff --git a/app/shaders/cornerpin.vert b/app/shaders/cornerpin.vert index 1eadf95fe..673c3e16c 100644 --- a/app/shaders/cornerpin.vert +++ b/app/shaders/cornerpin.vert @@ -8,15 +8,15 @@ uniform vec2 resolution_in; uniform mat4 ove_mvpmat; -attribute vec4 a_position; -attribute vec2 a_texcoord; +in vec4 a_position; +in vec2 a_texcoord; -varying vec2 ove_texcoord; +out vec2 ove_texcoord; -varying vec2 q; -varying vec2 b1; -varying vec2 b2; -varying vec2 b3; +out vec2 q; +out vec2 b1; +out vec2 b2; +out vec2 b3; void main() { // The slider inputs only contain the amount they have changed rather than @@ -37,7 +37,7 @@ void main() { float c1 = b_l.y - m1 * b_l.x; float m2 = (b_r.y - t_l.y)/(b_r.x - t_l.x); float c2 = t_l.y - m2 * t_l.x; - + // Find the intersection by setting the two line equations equal and rearrange. float mid_x = (c2 - c1) / (m1 - m2); float mid_y = m1 * mid_x + c1; @@ -70,7 +70,7 @@ void main() { } else { q = (d2+d0)/d0; } - + gl_Position[0] *= q; gl_Position[1] *= q; gl_Position[3] = q; @@ -93,7 +93,7 @@ void main() { b2 = t_l - b_l; b3 = b_l - b_r - t_l + t_r; } - + ove_texcoord = a_texcoord; } diff --git a/app/shaders/crop.frag b/app/shaders/crop.frag index a76b1219d..b022f9959 100644 --- a/app/shaders/crop.frag +++ b/app/shaders/crop.frag @@ -8,7 +8,8 @@ uniform float feather_in; uniform vec2 resolution_in; // Input texture coordinate -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main() { float multiplier = 1.0; @@ -45,8 +46,8 @@ void main() { if (multiplier > 0.0) { vec4 color = texture2D(tex_in, ove_texcoord) * multiplier; - gl_FragColor = color; + frag_color = color; } else { - gl_FragColor = vec4(0.0); + frag_color = vec4(0.0); } } diff --git a/app/shaders/crossdissolve.frag b/app/shaders/crossdissolve.frag index 7ddfa9055..e15c7b8d0 100644 --- a/app/shaders/crossdissolve.frag +++ b/app/shaders/crossdissolve.frag @@ -10,7 +10,8 @@ uniform int curve_in; uniform float ove_tprog_all; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; float TransformCurve(float linear) { if (curve_in == EXPONENTIAL_CURVE) { @@ -33,5 +34,5 @@ void main(void) { composite += texture2D(in_block_in, ove_texcoord) * TransformCurve(ove_tprog_all); } - gl_FragColor = composite; + frag_color = composite; } diff --git a/app/shaders/default.frag b/app/shaders/default.frag index 1182bd241..ee738debf 100644 --- a/app/shaders/default.frag +++ b/app/shaders/default.frag @@ -2,9 +2,10 @@ uniform sampler2D ove_maintex; // Input texture coordinate -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main() { vec4 color = texture2D(ove_maintex, ove_texcoord); - gl_FragColor = color; + frag_color = color; } diff --git a/app/shaders/default.vert b/app/shaders/default.vert index 0b3105a9b..9b2d55798 100644 --- a/app/shaders/default.vert +++ b/app/shaders/default.vert @@ -1,9 +1,9 @@ uniform mat4 ove_mvpmat; -attribute vec4 a_position; -attribute vec2 a_texcoord; +in vec4 a_position; +in vec2 a_texcoord; -varying vec2 ove_texcoord; +out vec2 ove_texcoord; void main() { gl_Position = ove_mvpmat * a_position; diff --git a/app/shaders/deinterlace.frag b/app/shaders/deinterlace.frag index d4f7b4c66..ea4fcbe0b 100644 --- a/app/shaders/deinterlace.frag +++ b/app/shaders/deinterlace.frag @@ -2,7 +2,8 @@ uniform sampler2D ove_maintex; uniform vec2 resolution_in; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; float round(float x) { @@ -19,5 +20,5 @@ void main() { using_texcoord.y = (round(using_texcoord.y * half_vert) + 0.25) / half_vert; vec4 color = texture2D(ove_maintex, using_texcoord); - gl_FragColor = color; + frag_color = color; } diff --git a/app/shaders/diptoblack.frag b/app/shaders/diptoblack.frag index cc3a8d68b..f2d6ffcfd 100644 --- a/app/shaders/diptoblack.frag +++ b/app/shaders/diptoblack.frag @@ -8,19 +8,20 @@ uniform float ove_tprog_all; uniform float ove_tprog_out; uniform float ove_tprog_in; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { if (out_block_in_enabled && in_block_in_enabled) { vec4 out_block_col = mix(texture2D(out_block_in, ove_texcoord), color_in, ove_tprog_out); vec4 in_block_col = mix(texture2D(in_block_in, ove_texcoord), color_in, 1.0 - ove_tprog_in); - gl_FragColor = out_block_col + in_block_col; + frag_color = out_block_col + in_block_col; } else if (out_block_in_enabled) { - gl_FragColor = mix(texture2D(out_block_in, ove_texcoord), color_in, ove_tprog_all); + frag_color = mix(texture2D(out_block_in, ove_texcoord), color_in, ove_tprog_all); } else if (in_block_in_enabled) { - gl_FragColor = mix(texture2D(in_block_in, ove_texcoord), color_in, 1.0 - ove_tprog_all); + frag_color = mix(texture2D(in_block_in, ove_texcoord), color_in, 1.0 - ove_tprog_all); } else { - gl_FragColor = vec4(0.0); + frag_color = vec4(0.0); } } diff --git a/app/shaders/flip.frag b/app/shaders/flip.frag index efc4fcf1d..2cbaa7671 100644 --- a/app/shaders/flip.frag +++ b/app/shaders/flip.frag @@ -2,11 +2,12 @@ uniform sampler2D tex_in; uniform bool horiz_in; uniform bool vert_in; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { if (!horiz_in && !vert_in) { - gl_FragColor = texture2D(tex_in, ove_texcoord); + frag_color = texture2D(tex_in, ove_texcoord); return; } @@ -15,5 +16,5 @@ void main(void) { if (horiz_in) new_coord.x = 1.0 - new_coord.x; if (vert_in) new_coord.y = 1.0 - new_coord.y; - gl_FragColor = texture2D(tex_in, new_coord); + frag_color = texture2D(tex_in, new_coord); } diff --git a/app/shaders/interlace.frag b/app/shaders/interlace.frag index 15cf182b9..f459d4f4b 100644 --- a/app/shaders/interlace.frag +++ b/app/shaders/interlace.frag @@ -2,14 +2,15 @@ uniform sampler2D top_tex_in; uniform sampler2D bottom_tex_in; uniform vec2 resolution_in; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main() { float y_pixel = floor(ove_texcoord.y * resolution_in.y); if (mod(y_pixel, 2.0) == 0.0) { - gl_FragColor = texture2D(top_tex_in, ove_texcoord); + frag_color = texture2D(top_tex_in, ove_texcoord); } else { - gl_FragColor = texture2D(bottom_tex_in, ove_texcoord); + frag_color = texture2D(bottom_tex_in, ove_texcoord); } } diff --git a/app/shaders/mosaic.frag b/app/shaders/mosaic.frag index a56f7c191..b9c2644a7 100644 --- a/app/shaders/mosaic.frag +++ b/app/shaders/mosaic.frag @@ -5,7 +5,8 @@ uniform float horiz_in; uniform float vert_in; // Input texture coordinate -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main() { float x; @@ -24,5 +25,5 @@ void main() { } vec4 color = texture2D(tex_in, vec2(x, y)); - gl_FragColor = color; + frag_color = color; } diff --git a/app/shaders/noise.frag b/app/shaders/noise.frag index 377c87357..4a2296e91 100644 --- a/app/shaders/noise.frag +++ b/app/shaders/noise.frag @@ -1,13 +1,13 @@ uniform float time_in; -varying vec2 ove_texcoord; uniform float strength_in; uniform bool color_in; //uniform bool blend; -// precision lowp float; +in vec2 ove_texcoord; +out vec4 frag_color; -float PHI = 1.61803398874989484820459 * 00000.1; // Golden Ratio +float PHI = 1.61803398874989484820459 * 00000.1; // Golden Ratio float PI = 3.14159265358979323846264 * 00000.1; // PI float SQ2 = 1.41421356237309504880169 * 10000.0; // Square Root of Two @@ -23,16 +23,16 @@ bool isNan( float val ) float gold_noise(vec2 coordinate, float seed){ float value = fract(tan(distance(coordinate*(seed+PHI), vec2(PHI, PI)))*SQ2)*(strength_in*0.01); - return isNan(value) ? 0.0 : value; + return isNan(value) ? 0.0 : value; } void main(void) { - vec3 noise; - if (color_in) { - noise = vec3(gold_noise(ove_texcoord, time_in + 42069.0), gold_noise(ove_texcoord, time_in + 69220.0), gold_noise(ove_texcoord, time_in + 1337.0)); - } else { - noise = vec3(gold_noise(ove_texcoord, time_in + 69420.0)); - } + vec3 noise; + if (color_in) { + noise = vec3(gold_noise(ove_texcoord, time_in + 42069.0), gold_noise(ove_texcoord, time_in + 69220.0), gold_noise(ove_texcoord, time_in + 1337.0)); + } else { + noise = vec3(gold_noise(ove_texcoord, time_in + 69420.0)); + } - gl_FragColor = vec4(noise, 1.0); + frag_color = vec4(noise, 1.0); } diff --git a/app/shaders/rgbhistogram.frag b/app/shaders/rgbhistogram.frag index 8fdfe53a6..845806000 100644 --- a/app/shaders/rgbhistogram.frag +++ b/app/shaders/rgbhistogram.frag @@ -2,7 +2,8 @@ uniform sampler2D ove_maintex; uniform vec2 viewport; uniform float histogram_scale; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { float histogram_width = ceil(histogram_scale * viewport.y); @@ -27,5 +28,5 @@ void main(void) { ); } - gl_FragColor = vec4(sum, 1.0); + frag_color = vec4(sum, 1.0); } diff --git a/app/shaders/rgbhistogram.vert b/app/shaders/rgbhistogram.vert index 6c3283f07..44100df79 100644 --- a/app/shaders/rgbhistogram.vert +++ b/app/shaders/rgbhistogram.vert @@ -1,9 +1,9 @@ uniform float histogram_scale; -attribute vec4 a_position; -attribute vec2 a_texcoord; +in vec4 a_position; +in vec2 a_texcoord; -varying vec2 ove_texcoord; +out vec2 ove_texcoord; mat4 scale_mat4(vec3 scale) { return mat4( diff --git a/app/shaders/rgbhistogram_secondary.frag b/app/shaders/rgbhistogram_secondary.frag index 1a6dc17b8..4cef66372 100644 --- a/app/shaders/rgbhistogram_secondary.frag +++ b/app/shaders/rgbhistogram_secondary.frag @@ -4,7 +4,8 @@ uniform vec2 viewport; uniform float histogram_scale; uniform float histogram_power; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { vec3 col = vec3(0.0); @@ -26,5 +27,5 @@ void main(void) { histogram_ratio = pow(sum / total_pixels, vec3(histogram_power)); col = step(vec3(ove_texcoord.y), histogram_ratio); - gl_FragColor = vec4(col, 1.0); + frag_color = vec4(col, 1.0); } diff --git a/app/shaders/rgbwaveform.frag b/app/shaders/rgbwaveform.frag index c43905055..d39ff4ab7 100644 --- a/app/shaders/rgbwaveform.frag +++ b/app/shaders/rgbwaveform.frag @@ -5,7 +5,8 @@ uniform vec3 luma_coeffs; uniform float waveform_scale; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { float waveform_height = ceil(waveform_scale * viewport.y); @@ -33,5 +34,5 @@ void main(void) { } col.rgb += vec3(col.w); - gl_FragColor = vec4(col.rgb, 1.0); + frag_color = vec4(col.rgb, 1.0); } diff --git a/app/shaders/rgbwaveform.vert b/app/shaders/rgbwaveform.vert index af1eec88b..33980f284 100644 --- a/app/shaders/rgbwaveform.vert +++ b/app/shaders/rgbwaveform.vert @@ -1,9 +1,9 @@ uniform float waveform_scale; -attribute vec4 a_position; -attribute vec2 a_texcoord; +in vec4 a_position; +in vec2 a_texcoord; -varying vec2 ove_texcoord; +out vec2 ove_texcoord; mat4 scale_mat4(vec3 scale) { return mat4( diff --git a/app/shaders/shape.frag b/app/shaders/shape.frag index 49ef8d309..f06b2ce7b 100644 --- a/app/shaders/shape.frag +++ b/app/shaders/shape.frag @@ -1,5 +1,6 @@ // Input texture coordinate -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; // Match with ShapeNode::Type #define SHAPE_RECTANGLE 0 @@ -37,5 +38,5 @@ void main() { col = color_in * (1.0-t); } - gl_FragColor = col; + frag_color = col; } diff --git a/app/shaders/solid.frag b/app/shaders/solid.frag index 159841e79..a5eafc268 100644 --- a/app/shaders/solid.frag +++ b/app/shaders/solid.frag @@ -1,5 +1,7 @@ uniform vec4 color_in; +out vec4 frag_color; + void main(void) { - gl_FragColor = color_in; + frag_color = color_in; } diff --git a/app/shaders/stroke.frag b/app/shaders/stroke.frag index ce6fef99f..1f286327b 100644 --- a/app/shaders/stroke.frag +++ b/app/shaders/stroke.frag @@ -9,7 +9,8 @@ uniform vec2 resolution_in; // Standard inputs uniform int ove_iteration; -varying vec2 ove_texcoord; +in vec2 ove_texcoord; +out vec4 frag_color; void main(void) { vec4 pixel_here = texture2D(tex_in, ove_texcoord); @@ -20,7 +21,7 @@ void main(void) { || (inner_in && pixel_here.a == 0.0) || (!inner_in && pixel_here.a == 1.0)) { // No-op, do nothing - gl_FragColor = pixel_here; + frag_color = pixel_here; return; } @@ -74,5 +75,5 @@ void main(void) { stroke_col = stroke_col * (1.0 - pixel_here.a) + pixel_here; } - gl_FragColor = stroke_col; + frag_color = stroke_col; }