documented and completed viewer GL widget

This commit is contained in:
itsmattkc
2019-06-22 23:21:13 -07:00
parent bac0d22ac2
commit fd8925d5f2
2 changed files with 102 additions and 13 deletions
+29 -13
View File
@@ -8,28 +8,44 @@
#include "render/gl/shadergenerators.h"
ViewerGLWidget::ViewerGLWidget(QWidget *parent) :
QOpenGLWidget(parent)
QOpenGLWidget(parent),
texture_(0)
{
}
void ViewerGLWidget::SetTexture(GLuint tex)
{
// Update the texture
texture_ = tex;
// Paint the texture
update();
}
void ViewerGLWidget::initializeGL()
{
// Re-retrieve pipeline pertaining to this context
pipeline_ = olive::gl::GetDefaultPipeline();
}
void ViewerGLWidget::paintGL()
{
/*
// Get functions attached to this context (they will already be initialized)
QOpenGLFunctions* f = context()->functions();
f->glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
// Clear background to empty
f->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
f->glClear(GL_COLOR_BUFFER_BIT);
QOpenGLTexture* tex = new QOpenGLTexture(img);
// Check if we have a texture to draw
if (texture_ > 0) {
// Bind retrieved texture
f->glBindTexture(GL_TEXTURE_2D, texture_);
ShaderPtr pipeline = olive::gl::GetDefaultPipeline();
// Blit using the pipeline retrieved in initializeGL()
olive::gl::Blit(pipeline_, true);
tex->bind();
olive::gl::Blit(pipeline, true);
tex->release();
delete tex;
*/
// Release retrieved texture
f->glBindTexture(GL_TEXTURE_2D, 0);
}
}