nearly finished gles transition
This commit is contained in:
+145
-121
@@ -39,71 +39,111 @@ namespace OCIO = OCIO_NAMESPACE;
|
||||
#include "effects/effect.h"
|
||||
#include "project/footage.h"
|
||||
#include "effects/transition.h"
|
||||
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
#include "rendering/audio.h"
|
||||
|
||||
#include "global/math.h"
|
||||
#include "global/config.h"
|
||||
|
||||
#include "panels/timeline.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "qopenglshaderprogramptr.h"
|
||||
|
||||
void full_blit() {
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, 1, 0, 1, -1, 1);
|
||||
GLfloat olive::rendering::blit_vertices[] = {
|
||||
-1.0f, -1.0f, 0.0f,
|
||||
1.0f, -1.0f, 0.0f,
|
||||
1.0f, 1.0f, 0.0f,
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); // top left
|
||||
glVertex2f(0, 0); // top left
|
||||
glTexCoord2f(1, 0); // top right
|
||||
glVertex2f(1, 0); // top right
|
||||
glTexCoord2f(1, 1); // bottom right
|
||||
glVertex2f(1, 1); // bottom right
|
||||
glTexCoord2f(0, 1); // bottom left
|
||||
glVertex2f(0, 1); // bottom left
|
||||
glEnd();
|
||||
-1.0f, -1.0f, 0.0f,
|
||||
-1.0f, 1.0f, 0.0f,
|
||||
1.0f, 1.0f, 0.0f
|
||||
};
|
||||
|
||||
glPopMatrix();
|
||||
GLfloat olive::rendering::blit_texcoords[] = {
|
||||
0.0, 0.0,
|
||||
1.0, 0.0,
|
||||
1.0, 1.0,
|
||||
|
||||
0.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 1.0
|
||||
};
|
||||
|
||||
void olive::rendering::Blit(QOpenGLShaderProgram* pipeline) {
|
||||
QOpenGLFunctions* func = QOpenGLContext::currentContext()->functions();
|
||||
|
||||
pipeline->bind();
|
||||
|
||||
pipeline->setUniformValue("mvp_matrix", QMatrix4x4());
|
||||
pipeline->setUniformValue("texture", 0);
|
||||
|
||||
GLuint vertex_location = pipeline->attributeLocation("a_position");
|
||||
func->glEnableVertexAttribArray(vertex_location);
|
||||
func->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, blit_vertices);
|
||||
|
||||
GLuint tex_location = pipeline->attributeLocation("a_texcoord");
|
||||
func->glEnableVertexAttribArray(tex_location);
|
||||
func->glVertexAttribPointer(tex_location, 2, GL_FLOAT, GL_FALSE, 0, blit_texcoords);
|
||||
|
||||
func->glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
pipeline->release();
|
||||
}
|
||||
|
||||
void draw_clip(QOpenGLContext* ctx, GLuint fbo, GLuint texture, bool clear) {
|
||||
QOpenGLShaderProgramPtr olive::rendering::GetPipeline()
|
||||
{
|
||||
QOpenGLShaderProgramPtr program = std::make_shared<QOpenGLShaderProgram>();
|
||||
|
||||
program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/internalshaders/pipeline.vert");
|
||||
program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/internalshaders/pipeline.frag");
|
||||
program->link();
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
void draw_clip(QOpenGLContext* ctx,
|
||||
QOpenGLShaderProgram* pipeline,
|
||||
GLuint fbo,
|
||||
GLuint texture,
|
||||
bool clear) {
|
||||
ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
|
||||
|
||||
if (clear) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
ctx->functions()->glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
ctx->functions()->glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
full_blit();
|
||||
olive::rendering::Blit(pipeline);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
GLuint draw_clip(const FramebufferObject& fbo, GLuint texture, bool clear) {
|
||||
GLuint draw_clip(QOpenGLContext* ctx,
|
||||
QOpenGLShaderProgram* pipeline,
|
||||
const FramebufferObject& fbo,
|
||||
GLuint texture,
|
||||
bool clear) {
|
||||
fbo.BindBuffer();
|
||||
|
||||
if (clear) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
ctx->functions()->glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
ctx->functions()->glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
full_blit();
|
||||
olive::rendering::Blit(pipeline);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
fbo.ReleaseBuffer();
|
||||
|
||||
return fbo.texture();
|
||||
}
|
||||
|
||||
void process_effect(Clip* c,
|
||||
void process_effect(QOpenGLContext* ctx,
|
||||
QOpenGLShaderProgram* pipeline,
|
||||
Clip* c,
|
||||
Effect* e,
|
||||
double timecode,
|
||||
GLTextureCoords& coords,
|
||||
@@ -121,7 +161,7 @@ void process_effect(Clip* c,
|
||||
if (can_process_shaders && e->is_glsl_linked()) {
|
||||
for (int i=0;i<e->getIterations();i++) {
|
||||
e->process_shader(timecode, coords, i);
|
||||
composite_texture = draw_clip(c->fbo[fbo_switcher], composite_texture, true);
|
||||
composite_texture = draw_clip(ctx, pipeline, c->fbo[fbo_switcher], composite_texture, true);
|
||||
fbo_switcher = !fbo_switcher;
|
||||
}
|
||||
}
|
||||
@@ -140,10 +180,10 @@ void process_effect(Clip* c,
|
||||
// if the source texture is not already a framebuffer texture,
|
||||
// we'll need to make it one before drawing a superimpose effect on it
|
||||
if (composite_texture != c->fbo[0].texture() && composite_texture != c->fbo[1].texture()) {
|
||||
draw_clip(c->fbo[!fbo_switcher], composite_texture, true);
|
||||
draw_clip(ctx, pipeline, c->fbo[!fbo_switcher], composite_texture, true);
|
||||
}
|
||||
|
||||
composite_texture = draw_clip(c->fbo[!fbo_switcher], superimpose_texture, false);
|
||||
composite_texture = draw_clip(ctx, pipeline, c->fbo[!fbo_switcher], superimpose_texture, false);
|
||||
}
|
||||
}
|
||||
e->endEffect();
|
||||
@@ -152,8 +192,6 @@ void process_effect(Clip* c,
|
||||
}
|
||||
|
||||
GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// qint64 time = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
GLuint final_fbo = params.main_buffer;
|
||||
|
||||
Sequence* s = params.seq;
|
||||
@@ -266,16 +304,19 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
}
|
||||
}
|
||||
|
||||
QMatrix4x4 projection;
|
||||
|
||||
if (params.video) {
|
||||
// set default coordinates based on the sequence, with 0 in the direct center
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
//glPushMatrix();
|
||||
//glLoadIdentity();
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
params.ctx->functions()->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
int half_width = s->width/2;
|
||||
int half_height = s->height/2;
|
||||
glOrtho(-half_width, half_width, -half_height, half_height, -1, 10);
|
||||
//glOrtho(-half_width, half_width, -half_height, half_height, -1, 10);
|
||||
projection.ortho(-half_width, half_width, -half_height, half_height, -1, 1);
|
||||
}
|
||||
|
||||
// loop through current clips
|
||||
@@ -296,9 +337,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// if clip is a video clip
|
||||
if (c->track() < 0) {
|
||||
|
||||
// reset OpenGL to full color
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
// textureID variable contains texture to be drawn on screen at the end
|
||||
GLuint textureID = 0;
|
||||
|
||||
@@ -316,7 +354,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
} else {
|
||||
// retrieve ID from c->texture
|
||||
textureID = c->texture->textureId();
|
||||
qDebug() << "tex 1" << textureID;
|
||||
}
|
||||
|
||||
if (textureID == 0) {
|
||||
@@ -339,15 +376,15 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// if clip should actually be shown on screen in this frame
|
||||
if (playhead >= c->timeline_in(true)
|
||||
&& playhead < c->timeline_out(true)) {
|
||||
glPushMatrix();
|
||||
|
||||
// simple bool for switching between the two framebuffers
|
||||
bool fbo_switcher = false;
|
||||
|
||||
glViewport(0, 0, video_width, video_height);
|
||||
params.ctx->functions()->glViewport(0, 0, video_width, video_height);
|
||||
|
||||
if (c->media() != nullptr) {
|
||||
if (c->media()->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
|
||||
// for a nested sequence, run this function again on that sequence and retrieve the texture
|
||||
|
||||
// add nested sequence to nest list
|
||||
@@ -361,6 +398,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
// compose_sequence() would have written to this clip's fbo[0], so we switch to fbo[1]
|
||||
fbo_switcher = !fbo_switcher;
|
||||
|
||||
} else if (c->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
|
||||
if (!c->media()->to_footage()->alpha_is_premultiplied) {
|
||||
@@ -368,13 +406,11 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// alpha is not premultiplied, we'll need to multiply it for the rest of the pipeline
|
||||
params.ctx->functions()->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ZERO);
|
||||
|
||||
qDebug() << "about to draw on" << fbo_switcher;
|
||||
textureID = draw_clip(c->fbo[fbo_switcher], textureID, true);
|
||||
textureID = draw_clip(params.ctx, params.pipeline, c->fbo[fbo_switcher], textureID, true);
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
params.ctx->functions()->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
fbo_switcher = !fbo_switcher;
|
||||
qDebug() << "tex 3" << textureID << fbo_switcher;
|
||||
|
||||
}
|
||||
|
||||
@@ -387,14 +423,12 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
params.ocio_shader->setUniformValue("tex1", 0);
|
||||
params.ocio_shader->setUniformValue("tex2", 2);
|
||||
|
||||
qDebug() << "about to draw on" << fbo_switcher;
|
||||
textureID = draw_clip(c->fbo[fbo_switcher], textureID, true);
|
||||
textureID = draw_clip(params.ctx, params.pipeline, c->fbo[fbo_switcher], textureID, true);
|
||||
|
||||
params.ocio_shader->release();
|
||||
|
||||
fbo_switcher = !fbo_switcher;
|
||||
|
||||
qDebug() << "tex 4" << textureID << fbo_switcher;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -403,15 +437,14 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
// set up default coordinates for drawing the clip
|
||||
GLTextureCoords coords;
|
||||
coords.grid_size = 1;
|
||||
coords.vertexTopLeftX = coords.vertexBottomLeftX = -video_width/2;
|
||||
coords.vertexTopLeftY = coords.vertexTopRightY = -video_height/2;
|
||||
coords.vertexTopRightX = coords.vertexBottomRightX = video_width/2;
|
||||
coords.vertexBottomLeftY = coords.vertexBottomRightY = video_height/2;
|
||||
coords.vertexBottomLeftZ = coords.vertexBottomRightZ = coords.vertexTopLeftZ = coords.vertexTopRightZ = 1;
|
||||
coords.textureTopLeftY = coords.textureTopRightY = coords.textureTopLeftX = coords.textureBottomLeftX = 0.0;
|
||||
coords.textureBottomLeftY = coords.textureBottomRightY = coords.textureTopRightX = coords.textureBottomRightX = 1.0;
|
||||
coords.textureTopLeftQ = coords.textureTopRightQ = coords.textureTopLeftQ = coords.textureBottomLeftQ = 1;
|
||||
coords.vertex_top_left = QVector3D(-video_width/2, -video_height/2, 0.0f);
|
||||
coords.vertex_top_right = QVector3D(video_width/2, -video_height/2, 0.0f);
|
||||
coords.vertex_bottom_left = QVector3D(-video_width/2, video_height/2, 0.0f);
|
||||
coords.vertex_bottom_right = QVector3D(video_width/2, video_height/2, 0.0f);
|
||||
coords.texture_top_left = QVector2D(0.0f, 0.0f);
|
||||
coords.texture_top_right = QVector2D(1.0f, 0.0f);
|
||||
coords.texture_bottom_left = QVector2D(0.0f, 1.0f);
|
||||
coords.texture_bottom_right = QVector2D(1.0f, 1.0f);
|
||||
coords.blendmode = -1;
|
||||
coords.opacity = 1.0;
|
||||
|
||||
@@ -424,9 +457,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
|
||||
Effect* e = c->effects.at(j).get();
|
||||
qDebug() << "about to draw on" << fbo_switcher;
|
||||
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, kTransitionNone);
|
||||
qDebug() << "tex 5" << textureID << fbo_switcher;
|
||||
process_effect(params.ctx, params.pipeline, c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, kTransitionNone);
|
||||
|
||||
|
||||
}
|
||||
@@ -435,7 +466,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
if (c->opening_transition != nullptr) {
|
||||
int transition_progress = playhead - c->timeline_in(true);
|
||||
if (transition_progress < c->opening_transition->get_length()) {
|
||||
process_effect(c, c->opening_transition.get(), double(transition_progress)/double(c->opening_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionOpening);
|
||||
process_effect(params.ctx, params.pipeline, c, c->opening_transition.get(), double(transition_progress)/double(c->opening_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionOpening);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,14 +474,16 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
if (c->closing_transition != nullptr) {
|
||||
int transition_progress = playhead - (c->timeline_out(true) - c->closing_transition->get_length());
|
||||
if (transition_progress >= 0 && transition_progress < c->closing_transition->get_length()) {
|
||||
process_effect(c, c->closing_transition.get(), double(transition_progress)/double(c->closing_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionClosing);
|
||||
process_effect(params.ctx, params.pipeline, c, c->closing_transition.get(), double(transition_progress)/double(c->closing_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionClosing);
|
||||
}
|
||||
}
|
||||
|
||||
// == EFFECT CODE END ==
|
||||
|
||||
|
||||
// Check whether the parent clip is auto-scaledc
|
||||
// Check whether the parent clip is auto-scaled
|
||||
// TODO redo this
|
||||
/*
|
||||
if (c->autoscaled()
|
||||
&& (video_width != s->width
|
||||
&& video_height != s->height)) {
|
||||
@@ -459,6 +492,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
float scale_multiplier = qMin(width_multiplier, height_multiplier);
|
||||
glScalef(scale_multiplier, scale_multiplier, 1);
|
||||
}
|
||||
*/
|
||||
|
||||
// Configure effect gizmos if they exist
|
||||
if (params.gizmos != nullptr) {
|
||||
@@ -468,7 +502,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
|
||||
|
||||
qDebug() << "final texture ID" << textureID;
|
||||
if (textureID > 0) {
|
||||
// set viewport to sequence size
|
||||
params.ctx->functions()->glViewport(0, 0, s->width, s->height);
|
||||
@@ -496,32 +529,57 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// render a backbuffer
|
||||
params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, back_buffer_1);
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
params.ctx->functions()->glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
params.ctx->functions()->glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// bind final clip texture
|
||||
glBindTexture(GL_TEXTURE_2D, textureID);
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, textureID);
|
||||
|
||||
// set texture filter to bilinear
|
||||
params.ctx->functions()->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
params.ctx->functions()->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
// draw clip on screen according to gl coordinates
|
||||
glBegin(GL_QUADS);
|
||||
params.pipeline->bind();
|
||||
|
||||
glTexCoord2f(coords.textureTopLeftX, coords.textureTopLeftY); // top left
|
||||
glVertex2f(coords.vertexTopLeftX, coords.vertexTopLeftY); // top left
|
||||
glTexCoord2f(coords.textureTopRightX, coords.textureTopRightY); // top right
|
||||
glVertex2f(coords.vertexTopRightX, coords.vertexTopRightY); // top right
|
||||
glTexCoord2f(coords.textureBottomRightX, coords.textureBottomRightY); // bottom right
|
||||
glVertex2f(coords.vertexBottomRightX, coords.vertexBottomRightY); // bottom right
|
||||
glTexCoord2f(coords.textureBottomLeftX, coords.textureBottomLeftY); // bottom left
|
||||
glVertex2f(coords.vertexBottomLeftX, coords.vertexBottomLeftY); // bottom left
|
||||
params.pipeline->setUniformValue("mvp_matrix", projection);
|
||||
params.pipeline->setUniformValue("texture", 0);
|
||||
|
||||
glEnd();
|
||||
GLfloat vertices[] = {
|
||||
coords.vertex_top_left.x(), coords.vertex_top_left.y(), 0.0f,
|
||||
coords.vertex_top_right.x(), coords.vertex_top_right.y(), 0.0f,
|
||||
coords.vertex_bottom_right.x(), coords.vertex_bottom_right.y(), 0.0f,
|
||||
|
||||
coords.vertex_top_left.x(), coords.vertex_top_left.y(), 0.0f,
|
||||
coords.vertex_bottom_left.x(), coords.vertex_bottom_left.y(), 0.0f,
|
||||
coords.vertex_bottom_right.x(), coords.vertex_bottom_right.y(), 0.0f,
|
||||
};
|
||||
|
||||
GLfloat texcoords[] = {
|
||||
coords.texture_top_left.x(), coords.texture_top_left.y(),
|
||||
coords.texture_top_right.x(), coords.texture_top_right.y(),
|
||||
coords.texture_bottom_right.x(), coords.texture_bottom_right.y(),
|
||||
|
||||
coords.texture_top_left.x(), coords.texture_top_left.y(),
|
||||
|
||||
coords.texture_bottom_left.x(), coords.texture_bottom_left.y(),
|
||||
coords.texture_bottom_right.x(), coords.texture_bottom_right.y(),
|
||||
};
|
||||
|
||||
GLuint vertex_location = params.pipeline->attributeLocation("a_position");
|
||||
params.ctx->functions()->glEnableVertexAttribArray(vertex_location);
|
||||
params.ctx->functions()->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
|
||||
GLuint tex_location = params.pipeline->attributeLocation("a_texcoord");
|
||||
params.ctx->functions()->glEnableVertexAttribArray(tex_location);
|
||||
params.ctx->functions()->glVertexAttribPointer(tex_location, 2, GL_FLOAT, GL_FALSE, 0, texcoords);
|
||||
|
||||
params.ctx->functions()->glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
params.pipeline->release();
|
||||
|
||||
// release final clip texture
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
@@ -542,9 +600,9 @@ GLuint 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.nests.last()->fbo[2].buffer(), params.nests.last()->fbo[0].texture(), true);
|
||||
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.backend_buffer2, params.main_attachment, true);
|
||||
draw_clip(params.ctx, params.pipeline, params.backend_buffer2, params.main_attachment, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,20 +619,14 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// Check if we're using a blend mode (< 0 means no blend mode)
|
||||
if (coords.blendmode < 0) {
|
||||
|
||||
qDebug() << "normal blending";
|
||||
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, backend_tex_1);
|
||||
|
||||
glColor4f(coords.opacity, coords.opacity, coords.opacity, coords.opacity);
|
||||
|
||||
full_blit();
|
||||
olive::rendering::Blit(params.pipeline);
|
||||
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
} else {
|
||||
|
||||
qDebug() << "blending mode?";
|
||||
|
||||
// load background texture into texture unit 0
|
||||
params.ctx->functions()->glActiveTexture(GL_TEXTURE0 + 0); // Texture unit 0
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, backend_tex_2);
|
||||
@@ -590,9 +642,9 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
params.blend_mode_program->setUniformValue("background", 0);
|
||||
params.blend_mode_program->setUniformValue("foreground", 1);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
params.ctx->functions()->glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
full_blit();
|
||||
olive::rendering::Blit(params.pipeline);
|
||||
|
||||
// release blend mode shader
|
||||
params.blend_mode_program->release();
|
||||
@@ -615,18 +667,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// == END FINAL DRAW ON SEQUENCE BUFFER ==
|
||||
}
|
||||
|
||||
// prepare gizmos
|
||||
/*
|
||||
if ((*params.gizmos) != nullptr
|
||||
&& params.nests.isEmpty()
|
||||
&& ((*params.gizmos) == first_gizmo_effect
|
||||
|| (*params.gizmos) == selected_effect)) {
|
||||
(*params.gizmos)->gizmo_draw(timecode, coords); // set correct gizmo coords
|
||||
(*params.gizmos)->gizmo_world_to_screen(); // convert gizmo coords to screen coords
|
||||
}
|
||||
*/
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
} else {
|
||||
if (c->media() != nullptr && c->media()->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
@@ -646,22 +686,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// visually update all the keyframe values
|
||||
if (c->sequence == params.seq) { // only if you can currently see them
|
||||
double ts = (playhead - c->timeline_in(true) + c->clip_in(true))/s->frame_rate;
|
||||
for (int i=0;i<c->effects.size();i++) {
|
||||
EffectPtr e = c->effects.at(i);
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* r = e->row(j);
|
||||
for (int k=0;k<r->fieldCount();k++) {
|
||||
r->field(k)->validate_keyframe_data(ts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
} else {
|
||||
params.texture_failed = true;
|
||||
|
||||
Reference in New Issue
Block a user