enforce trilinear and mipmap generation

This commit is contained in:
itsmattkc
2019-03-28 18:21:35 +11:00
parent c468d023b0
commit 4e0188fd3a
7 changed files with 32 additions and 18 deletions
+1 -1
View File
@@ -574,7 +574,7 @@ void ExportThread::Export()
return;
}
// Flush remaining packets out of video and audio encoders
// Flush remaining packets out of video and audio encoders by sending a null frame
if (params_.video_enabled) {
Encode(fmt_ctx, vcodec_ctx, nullptr, &video_pkt, video_stream);
}
+12 -10
View File
@@ -26,37 +26,39 @@ void FramebufferObject::Create(QOpenGLContext *ctx, int width, int height)
// set context to new context provided
ctx_ = ctx;
QOpenGLFunctions* f = ctx->functions();
// create framebuffer object
ctx->functions()->glGenFramebuffers(1, &buffer_);
f->glGenFramebuffers(1, &buffer_);
// create texture
ctx->functions()->glGenTextures(1, &texture_);
f->glGenTextures(1, &texture_);
// bind framebuffer for attaching
ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer_);
f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer_);
// bind texture
ctx->functions()->glBindTexture(GL_TEXTURE_2D, texture_);
f->glBindTexture(GL_TEXTURE_2D, texture_);
// allocate storage for texture
ctx->functions()->glTexImage2D(
f->glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr
);
// set texture filtering to bilinear
ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// attach texture to framebuffer
ctx->functions()->glFramebufferTexture2D(
f->glFramebufferTexture2D(
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_, 0
);
// release texture
ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
f->glBindTexture(GL_TEXTURE_2D, 0);
// release framebuffer
ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}
void FramebufferObject::Destroy()
+11 -3
View File
@@ -51,7 +51,17 @@ namespace OCIO = OCIO_NAMESPACE;
#include "panels/timeline.h"
#include "panels/viewer.h"
void PrepareToDraw(QOpenGLFunctions* f) {
f->glGenerateMipmap(GL_TEXTURE_2D);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
void full_blit() {
PrepareToDraw(QOpenGLContext::currentContext()->functions());
glPushMatrix();
glLoadIdentity();
glOrtho(0, 1, 0, 1, -1, 1);
@@ -484,9 +494,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams &params) {
glBindTexture(GL_TEXTURE_2D, textureID);
// set texture filter to bilinear
params.ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
params.ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
params.ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
PrepareToDraw(params.ctx->functions());
// draw clip on screen according to gl coordinates
glBegin(GL_QUADS);