]> git.sesse.net Git - pkanalytics/blobdiff - video_widget.cpp
Do everything through QOpenGLFunctions, in case it loads a weird library.
[pkanalytics] / video_widget.cpp
index 63efa7d866dd363c42f290e0fa6c4e0a867f8517..d397eebd6e2a08ceab92a620aae3b8f3a4049c04 100644 (file)
@@ -302,9 +302,9 @@ void VideoWindow::initializeGL()
 {
        gl = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_5_Compatibility>(context());
 
-       glDisable(GL_BLEND);
-       glDisable(GL_DEPTH_TEST);
-       glDepthMask(GL_FALSE);
+       gl->glDisable(GL_BLEND);
+       gl->glDisable(GL_DEPTH_TEST);
+       gl->glDepthMask(GL_FALSE);
        gl->glCreateTextures(GL_TEXTURE_2D, 3, tex);
 
        ycbcr_vertex_shader = compile_shader(gl, R"(
@@ -385,7 +385,7 @@ void main()
 
 void VideoWindow::resizeGL(int w, int h)
 {
-       glViewport(0, 0, w, h);
+       gl->glViewport(0, 0, w, h);
        display_aspect = double(w) / h;
 }
 
@@ -408,7 +408,7 @@ void VideoWindow::paintGL()
                frame = current_frame;
        }
        if (frame == nullptr) {
-               glClear(GL_COLOR_BUFFER_BIT);
+               gl->glClear(GL_COLOR_BUFFER_BIT);
                return;
        }
 
@@ -429,7 +429,7 @@ void VideoWindow::paintGL()
                frame->need_flush_len = 0;
        }
 
-       glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+       gl->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
        gl->glTextureSubImage2D(tex[0], 0, 0, 0, frame->width, frame->height, GL_RED, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
        gl->glGenerateTextureMipmap(tex[0]);
 
@@ -468,27 +468,27 @@ void VideoWindow::paintGL()
                ty2 = 1.0 + 0.5 * extra_height / frame->height;
        }
 
-       glBegin(GL_QUADS);
+       gl->glBegin(GL_QUADS);
 
        // (0,0)
        gl->glVertexAttrib2f(1, tx1, ty1);
-       glVertex2f(zoom_matrix[2 * 3 + 0], zoom_matrix[2 * 3 + 1]);
+       gl->glVertex2f(zoom_matrix[2 * 3 + 0], zoom_matrix[2 * 3 + 1]);
 
        // (0,1)
        gl->glVertexAttrib2f(1, tx1, ty2);
-       glVertex2f(zoom_matrix[1 * 3 + 0] + zoom_matrix[2 * 3 + 0], zoom_matrix[1 * 3 + 1] + zoom_matrix[2 * 3 + 1]);
+       gl->glVertex2f(zoom_matrix[1 * 3 + 0] + zoom_matrix[2 * 3 + 0], zoom_matrix[1 * 3 + 1] + zoom_matrix[2 * 3 + 1]);
 
        // (1,1)
        gl->glVertexAttrib2f(1, tx2, ty2);
-       glVertex2f(zoom_matrix[0 * 3 + 0] + zoom_matrix[1 * 3 + 0] + zoom_matrix[2 * 3 + 0],
+       gl->glVertex2f(zoom_matrix[0 * 3 + 0] + zoom_matrix[1 * 3 + 0] + zoom_matrix[2 * 3 + 0],
                   zoom_matrix[1 * 3 + 0] + zoom_matrix[1 * 3 + 1] + zoom_matrix[2 * 3 + 1]);
 
        // (1,0)
        gl->glVertexAttrib2f(1, tx2, ty1);
-       glVertex2f(zoom_matrix[0 * 3 + 0] + zoom_matrix[2 * 3 + 0],
+       gl->glVertex2f(zoom_matrix[0 * 3 + 0] + zoom_matrix[2 * 3 + 0],
                   zoom_matrix[1 * 3 + 0] + zoom_matrix[2 * 3 + 1]);
 
-       glEnd();
+       gl->glEnd();
 }
 
 void VideoWindow::set_current_frame(shared_ptr<VideoWidget::Frame> new_frame)