]> git.sesse.net Git - kdenlive/blobdiff - src/videoglwidget.cpp
Fix issues with OpenGL aspect ration / corruption and DVD wizard monitor
[kdenlive] / src / videoglwidget.cpp
index 9595ef254da658d7c1ab6126f071619fd915f230..eff90f6ea97f53e1397fb9ab1fa443752ead13ac 100644 (file)
@@ -19,7 +19,7 @@ VideoGLWidget::VideoGLWidget(QWidget *parent)
     , m_texture(0)
     , m_display_ratio(4.0 / 3.0)
     , m_backgroundColor(Qt::gray)
-{
+{  
     setAttribute(Qt::WA_PaintOnScreen);
     setAttribute(Qt::WA_OpaquePaintEvent);
 }
@@ -59,7 +59,6 @@ void VideoGLWidget::resizeEvent(QResizeEvent* event)
 }
 void VideoGLWidget::resizeGL(int width, int height)
 {
-
     double this_aspect = (double) width / height;
 
     // Special case optimisation to negate odd effect of sample aspect ratio
@@ -87,6 +86,17 @@ void VideoGLWidget::resizeGL(int width, int height)
     glClear(GL_COLOR_BUFFER_BIT);
 }
 
+void VideoGLWidget::activateMonitor()
+{
+    makeCurrent();
+    glViewport(0, 0, width(), height());
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    gluOrtho2D(0, width(), height(), 0);
+    glMatrixMode(GL_MODELVIEW);
+    glClear(GL_COLOR_BUFFER_BIT);
+}
+
 void VideoGLWidget::paintGL()
 {
     if (m_texture) {
@@ -112,7 +122,6 @@ void VideoGLWidget::showImage(QImage image)
 {
     m_image_width = image.width();
     m_image_height = image.height();
-
     makeCurrent();
     if (m_texture)
         glDeleteTextures(1, &m_texture);