]> git.sesse.net Git - pkanalytics/commitdiff
Do everything through QOpenGLFunctions, in case it loads a weird library.
authorSteinar H. Gunderson <sesse@chromium.org>
Mon, 31 Jul 2023 19:36:16 +0000 (21:36 +0200)
committerSteinar H. Gunderson <sesse@chromium.org>
Mon, 31 Jul 2023 19:36:16 +0000 (21:36 +0200)
meson.build
video_widget.cpp

index af7d23a460a4e14f7cef20c12d0fb6a12b3badf3..bd9900bc22db4ccb20909ba6e60bfb5e5231933a 100644 (file)
@@ -7,7 +7,6 @@ libavcodecdep = dependency('libavcodec')
 libavformatdep = dependency('libavformat')
 libavutildep = dependency('libavutil')
 libswscaledep = dependency('libswscale')
-gldep = dependency('gl')
 
 qt_files = qt6.preprocess(
         moc_headers: ['mainwindow.h', 'clickable_label.h', 'video_widget.h'],
@@ -17,4 +16,4 @@ qt_files = qt6.preprocess(
 executable('stats',
            ['main.cpp', 'mainwindow.cpp', 'events.cpp', 'players.cpp', 'formations.cpp', 'json.cpp', 'video_widget.cpp', 'ffmpeg_raii.cpp'],
            qt_files,
-           dependencies: [qt6deps, sqlite3dep, libavcodecdep, libavformatdep, libavutildep, libswscaledep, gldep])
+           dependencies: [qt6deps, sqlite3dep, libavcodecdep, libavformatdep, libavutildep, libswscaledep])
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)