diff --git a/effects/shaders/crop.frag b/effects/shaders/crop.frag index 062f22c2f..574360312 100644 --- a/effects/shaders/crop.frag +++ b/effects/shaders/crop.frag @@ -7,18 +7,32 @@ uniform float feather; uniform mediump float amount_val; vec4 process(vec4 col) { - float alpha = col.a; + float alpha = 1.0; + + if (feather == 0.0) { if (v_texcoord.x < (left*0.01) || v_texcoord.y < (top*0.01) || v_texcoord.x > (1.0-(right*0.01)) || v_texcoord.y > (1.0-(bottom*0.01))) { alpha = 0.0; } } else { float f = pow(2.0, 10.0-(feather*0.1)); - if (left > 0.0) alpha = alpha * clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left - if (top > 0.0) alpha = alpha * clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top - if (right > 0.0) alpha = alpha * clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right - if (bottom > 0.0) alpha = alpha * clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom + + if (left > 0.0) { + alpha = clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left + } + + if (top > 0.0) { + alpha = clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top + } + + if (right > 0.0) { + alpha = clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right + } + + if (bottom > 0.0) { + alpha = clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom + } } - return vec4(col.rgb*alpha, alpha); + return col * alpha; } \ No newline at end of file diff --git a/effects/shaders/flip.frag b/effects/shaders/flip.frag index 6a55cc8ca..6bdb05a9c 100644 --- a/effects/shaders/flip.frag +++ b/effects/shaders/flip.frag @@ -1,23 +1,14 @@ -#version 110 - uniform bool horiz; uniform bool vert; -uniform sampler2D myTexture; -varying vec2 vTexCoord; +vec4 process(vec4 col) { + float x = v_texcoord.x; + float y = v_texcoord.y; -void main(void) { - float x = vTexCoord.x; - float y = vTexCoord.y; + if (!horiz && !vert) return col; if (horiz) x = 1.0 - x; if (vert) y = 1.0 - y; - vec4 textureColor = texture2D(myTexture, vec2(x, y)); - gl_FragColor = vec4( - textureColor.r, - textureColor.g, - textureColor.b, - textureColor.a - ); + return texture2D(texture, vec2(x, y)); } \ No newline at end of file diff --git a/effects/shaders/gaussianblur.frag b/effects/shaders/gaussianblur.frag index ab015051f..e1d08a367 100644 --- a/effects/shaders/gaussianblur.frag +++ b/effects/shaders/gaussianblur.frag @@ -1,11 +1,5 @@ #define M_PI 3.1415926535897932384626433832795 -<<<<<<< HEAD -======= -uniform sampler2D image; - -//uniform float radius; ->>>>>>> master uniform float sigma; uniform vec2 resolution; uniform bool horiz_blur; diff --git a/rendering/renderfunctions.cpp b/rendering/renderfunctions.cpp index 806ab318d..69b098372 100644 --- a/rendering/renderfunctions.cpp +++ b/rendering/renderfunctions.cpp @@ -573,16 +573,22 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) { // use clip textures for nested sequences, otherwise use main frame buffers GLuint back_buffer_1; + GLuint back_buffer_2; GLuint backend_tex_1; GLuint backend_tex_2; + GLuint comp_texture; if (params.nests.size() > 0) { back_buffer_1 = params.nests.last()->fbo[1].buffer(); + back_buffer_2 = params.nests.last()->fbo[2].buffer(); backend_tex_1 = params.nests.last()->fbo[1].texture(); backend_tex_2 = params.nests.last()->fbo[2].texture(); + comp_texture = params.nests.last()->fbo[0].texture(); } else { back_buffer_1 = params.backend_buffer1->buffer(); + back_buffer_2 = params.backend_buffer2->buffer(); backend_tex_1 = params.backend_buffer1->texture(); backend_tex_2 = params.backend_buffer2->texture(); + comp_texture = params.main_buffer->texture(); } // render a backbuffer @@ -679,11 +685,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) { // copy front buffer to back buffer (only if we're using a blending mode) if (coords.blendmode >= 0) { - if (params.nests.size() > 0) { - draw_clip(params.ctx, params.pipeline, params.nests.last()->fbo[2].buffer(), params.nests.last()->fbo[0].texture(), true); - } else { - draw_clip(params.ctx, params.pipeline, params.backend_buffer2->buffer(), params.main_buffer->texture(), true); - } + draw_clip(params.ctx, params.pipeline, back_buffer_2, comp_texture, true); } diff --git a/rendering/renderthread.cpp b/rendering/renderthread.cpp index f9699a220..352224d36 100644 --- a/rendering/renderthread.cpp +++ b/rendering/renderthread.cpp @@ -255,6 +255,7 @@ void RenderThread::paint() { // If we're not color managing, just blit normally buffer.BindBuffer(); + f->glClear(GL_COLOR_BUFFER_BIT); composite_buffer.BindTexture(); olive::rendering::Blit(pipeline_program.get()); composite_buffer.ReleaseTexture();