reimplemented opacity without blending modes

This commit is contained in:
itsmattkc
2019-02-02 12:31:42 +11:00
parent b557979fb8
commit 064d1f229e
11 changed files with 60 additions and 50 deletions
+7 -5
View File
@@ -24,8 +24,6 @@
#include "panels/timeline.h"
#include "panels/viewer.h"
bool disable_blending = false;
extern "C" {
#include <libavformat/avformat.h>
}
@@ -95,7 +93,7 @@ void process_effect(Clip* c,
if (e->enable_coords) {
e->process_coords(timecode, coords, data);
}
bool can_process_shaders = (e->enable_shader && shaders_are_enabled);
bool can_process_shaders = (e->enable_shader && runtime_config.shaders_are_enabled);
if (can_process_shaders || e->enable_superimpose) {
e->startEffect();
if (can_process_shaders && e->is_glsl_linked()) {
@@ -489,7 +487,7 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
// copy front buffer to back buffer (only if we're using blending modes - which we usually will be)
if (!disable_blending) {
if (!runtime_config.disable_blending) {
if (params.nests.size() > 0) {
draw_clip(params.ctx, params.nests.last()->fbo[2]->handle(), params.nests.last()->fbo[0]->texture(), true);
} else {
@@ -506,13 +504,17 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
// bind front buffer as draw buffer
params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, final_fbo);
if (disable_blending) {
if (runtime_config.disable_blending) {
// some GPUs don't like the blending shader, so we provide a pure GL fallback here
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, backend_tex_1);
glColor4f(coords.opacity, coords.opacity, coords.opacity, coords.opacity);
full_blit();
// glColor4f(1.0, 1.0, 1.0, 1.0);
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
} else {
// load background texture into texture unit 0