mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
parent
e441b5d240
commit
2d135cc1bb
6 changed files with 539 additions and 127 deletions
|
@ -34,10 +34,14 @@
|
|||
#include <X11/extensions/XInput2.h>
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_) || defined(_IRR_COMPILE_WITH_OGLES2_)
|
||||
#if defined(_IRR_COMPILE_WITH_OGLES2_)
|
||||
#include "CEGLManager.h"
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_)
|
||||
#include "CGLXManager.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_LINUX_XCURSOR_
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#endif
|
||||
|
@ -148,20 +152,8 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters ¶m) :
|
|||
// without it, multi-threaded GL drivers may crash
|
||||
XInitThreads();
|
||||
|
||||
// create window
|
||||
if (CreationParams.DriverType != video::EDT_NULL) {
|
||||
// initialize EGL so it can choose a config
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_) || defined(_IRR_COMPILE_WITH_OGLES2_)
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = 0; // not created yet, but that's ok
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager = new video::CEGLManager();
|
||||
if (!ContextManager->initialize(CreationParams, data))
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// create the window, only if we do not use the null device
|
||||
if (!createWindow())
|
||||
return;
|
||||
|
@ -405,14 +397,14 @@ bool CIrrDeviceLinux::createWindow()
|
|||
if (WMCheck != None)
|
||||
HasNetWM = true;
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_) || defined(_IRR_COMPILE_WITH_OGLES2_)
|
||||
if (ContextManager) {
|
||||
auto *c = static_cast<video::CEGLManager*>(ContextManager);
|
||||
os::Printer::log("Using X visual from EGL");
|
||||
XVisualInfo templ;
|
||||
int n;
|
||||
templ.visualid = static_cast<VisualID>(c->getNativeVisualID());
|
||||
VisualInfo = XGetVisualInfo(XDisplay, VisualIDMask, &templ, &n);
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_)
|
||||
// don't use the XVisual with OpenGL, because it ignores all requested
|
||||
// properties of the CreationParams
|
||||
if (CreationParams.DriverType == video::EDT_OPENGL) {
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
ContextManager = new video::CGLXManager(CreationParams, data, Screennr);
|
||||
VisualInfo = ((video::CGLXManager *)ContextManager)->getVisual();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -551,7 +543,9 @@ void CIrrDeviceLinux::createDriver()
|
|||
{
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
static_cast<video::CEGLManager*>(ContextManager)->setWindow(data);
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
|
@ -564,7 +558,10 @@ void CIrrDeviceLinux::createDriver()
|
|||
{
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
static_cast<video::CEGLManager*>(ContextManager)->setWindow(data);
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager = new video::CEGLManager();
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
|
@ -577,7 +574,10 @@ void CIrrDeviceLinux::createDriver()
|
|||
{
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
static_cast<video::CEGLManager*>(ContextManager)->setWindow(data);
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager = new video::CEGLManager();
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
|
||||
VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue