MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / init

Method init

platform/linux/platformOpenGL.cpp:50–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void PlatformOpenGL::init() {
51 formatsById.clear();
52 formats.clear();
53 hardwareListLoaded = false;
54
55 if (KSystem::videoOption == VIDEO_NORMAL) {
56 int nativeCount = 0;
57 void* libx11 = dlopen("libX11.so", RTLD_NOW | RTLD_LOCAL);
58 if (!libx11) {
59 libx11 = dlopen("libX11.so.6", RTLD_NOW | RTLD_LOCAL);
60 }
61 if (!libx11) {
62 return;
63 }
64 void* libgl = dlopen("libGL.so", RTLD_NOW | RTLD_LOCAL);
65 if (!libgl) {
66 libgl = dlopen("libGL.so.1", RTLD_NOW | RTLD_LOCAL);
67 }
68 if (!libgl) {
69 dlclose(libx11);
70 return;
71 }
72
73 PFNXOpenDisplay pfnXOpenDisplay = (PFNXOpenDisplay)dlsym(libx11, "XOpenDisplay");
74 PFNXCloseDisplay pfnXCloseDisplay = (PFNXCloseDisplay)dlsym(libx11, "XCloseDisplay");
75 PFNXFree pfnXFree = (PFNXFree)dlsym(libgl, "XFree");
76
77 PFNglXGetFBConfigs pfnglXGetFBConfigs = (PFNglXGetFBConfigs)dlsym(libgl, "glXGetFBConfigs");
78 pfnglXGetFBConfigAttrib = (PFNglXGetFBConfigAttrib)dlsym(libgl, "glXGetFBConfigAttrib");
79
80 if (!pfnXOpenDisplay || !pfnXCloseDisplay || !pfnXFree || !pfnglXGetFBConfigs || !pfnglXGetFBConfigAttrib) {
81 dlclose(libx11);
82 dlclose(libgl);
83 return;
84 }
85 Display* dsp = pfnXOpenDisplay(0);
86 if (!dsp) {
87 klog("could not open display");
88 dlclose(libx11);
89 dlclose(libgl);
90 return;
91 }
92 GLXFBConfig* nativeConfigs = pfnglXGetFBConfigs(dsp, DefaultScreen(dsp), &nativeCount);
93 if (!nativeConfigs || !nativeCount) {
94 pfnXCloseDisplay(dsp);
95 dlclose(libx11);
96 dlclose(libgl);
97 return;
98 }
99 for (int i = 0; i < nativeCount; i++)
100 {
101 GLPixelFormatPtr format = std::make_shared<GLPixelFormat>();
102
103 const GLXFBConfig cfg = nativeConfigs[i];
104 int renderType = getGLXFBConfigAttrib(dsp, cfg, GLX_RENDER_TYPE);
105 int drawableType = getGLXFBConfigAttrib(dsp, cfg, GLX_DRAWABLE_TYPE);
106 bool doubleBuffer = false;
107

Callers

nothing calls this directly

Calls 5

klogFunction · 0.85
getGLXFBConfigAttribFunction · 0.85
clearMethod · 0.45
setMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected