Skip to content

Commit

Permalink
UI: Set the Unix platform on startup
Browse files Browse the repository at this point in the history
Move the OBS_USE_EGL environment variable check to obs-app.cpp,
and set the OBS platform to be either OBS_NIX_PLATFORM_X11_GLX
or OBS_NIX_PLATFORM_X11_EGL.
  • Loading branch information
GeorgesStavracas committed Sep 20, 2020
1 parent 3396595 commit e08d60f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions UI/obs-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,10 @@ bool OBSApp::OBSInit()
#if !defined(_WIN32) && !defined(__APPLE__)
obs_set_nix_platform(OBS_NIX_PLATFORM_X11_GLX);
if (QApplication::platformName() == "xcb") {
if (getenv("OBS_USE_EGL")) {
blog(LOG_INFO, "Using EGL/X11");
obs_set_nix_platform(OBS_NIX_PLATFORM_X11_EGL);
}
obs_set_nix_platform_display(QX11Info::display());
}
#endif
Expand Down
10 changes: 6 additions & 4 deletions libobs-opengl/gl-nix.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ static void init_winsys(void)
{
assert(gl_vtable == NULL);

if (getenv("OBS_USE_EGL")) {
gl_vtable = gl_x11_egl_get_winsys_vtable();
blog(LOG_INFO, "Using EGL/X11");
} else {
switch (obs_get_nix_platform()) {
case OBS_NIX_PLATFORM_X11_GLX:
gl_vtable = gl_x11_glx_get_winsys_vtable();
break;
case OBS_NIX_PLATFORM_X11_EGL:
gl_vtable = gl_x11_egl_get_winsys_vtable();
break;
}

assert(gl_vtable != NULL);
Expand Down
2 changes: 2 additions & 0 deletions libobs-opengl/gl-nix.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#pragma once

#include <obs-nix-platform.h>

#include "gl-subsystem.h"

struct gl_winsys_vtable {
Expand Down

0 comments on commit e08d60f

Please sign in to comment.