From: Steinar H. Gunderson Date: Mon, 31 Jul 2023 19:36:16 +0000 (+0200) Subject: Do everything through QOpenGLFunctions, in case it loads a weird library. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3197139e63a81589578f0caaa8c435241d3fbb11;hp=05a32509046f05d110de9e847025544c2a36ed02;p=pkanalytics Do everything through QOpenGLFunctions, in case it loads a weird library. --- diff --git a/meson.build b/meson.build index af7d23a..bd9900b 100644 --- a/meson.build +++ b/meson.build @@ -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]) diff --git a/video_widget.cpp b/video_widget.cpp index 63efa7d..d397eeb 100644 --- a/video_widget.cpp +++ b/video_widget.cpp @@ -302,9 +302,9 @@ void VideoWindow::initializeGL() { gl = QOpenGLVersionFunctionsFactory::get(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 new_frame)