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

pull/24508/head
Willem Melching 3 years ago committed by GitHub
parent 0926c269af
commit aac7248a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      selfdrive/ui/qt/widgets/cameraview.cc

@ -13,7 +13,7 @@ namespace {
const char frame_vertex_shader[] = const char frame_vertex_shader[] =
#ifdef __APPLE__ #ifdef __APPLE__
"#version 150 core\n" "#version 330 core\n"
#else #else
"#version 300 es\n" "#version 300 es\n"
#endif #endif
@ -28,7 +28,7 @@ const char frame_vertex_shader[] =
const char frame_fragment_shader[] = const char frame_fragment_shader[] =
#ifdef __APPLE__ #ifdef __APPLE__
"#version 150 core\n" "#version 330 core\n"
#else #else
"#version 300 es\n" "#version 300 es\n"
"precision mediump float;\n" "precision mediump float;\n"
@ -227,7 +227,7 @@ void CameraViewWidget::paintGL() {
glBindTexture(GL_TEXTURE_2D, textures[i]); glBindTexture(GL_TEXTURE_2D, textures[i]);
int width = i == 0 ? stream_width : stream_width / 2; int width = i == 0 ? stream_width : stream_width / 2;
int height = i == 0 ? stream_height : stream_height / 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); 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); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
int width = i == 0 ? stream_width : stream_width / 2; int width = i == 0 ? stream_width : stream_width / 2;
int height = i == 0 ? stream_height : stream_height / 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); assert(glGetError() == GL_NO_ERROR);
} }

Loading…
Cancel
Save