ui: fix cameraview widget on MacOS after YUV changes (#24506)

old-commit-hash: aac7248a0150c0f31d1a45eb9f7f84af551b4691
This commit is contained in:
Willem Melching
2022-05-12 17:16:30 +02:00
committed by GitHub
parent 561e9bac2f
commit 860487c4b7
+4 -4
View File
@@ -13,7 +13,7 @@ namespace {
const char frame_vertex_shader[] =
#ifdef __APPLE__
"#version 150 core\n"
"#version 330 core\n"
#else
"#version 300 es\n"
#endif
@@ -28,7 +28,7 @@ const char frame_vertex_shader[] =
const char frame_fragment_shader[] =
#ifdef __APPLE__
"#version 150 core\n"
"#version 330 core\n"
#else
"#version 300 es\n"
"precision mediump float;\n"
@@ -227,7 +227,7 @@ void CameraViewWidget::paintGL() {
glBindTexture(GL_TEXTURE_2D, textures[i]);
int width = i == 0 ? stream_width : stream_width / 2;
int height = i == 0 ? stream_height : stream_height / 2;
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, address[i]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RED, GL_UNSIGNED_BYTE, address[i]);
assert(glGetError() == GL_NO_ERROR);
}
@@ -256,7 +256,7 @@ void CameraViewWidget::vipcConnected(VisionIpcClient *vipc_client) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
int width = i == 0 ? stream_width : stream_width / 2;
int height = i == 0 ? stream_height : stream_height / 2;
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, nullptr);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, nullptr);
assert(glGetError() == GL_NO_ERROR);
}