mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Non-SDL: Add opengl3 support
This commit is contained in:
parent
87ac32edea
commit
4838eb2f7d
10 changed files with 107 additions and 139 deletions
|
@ -38,7 +38,7 @@
|
|||
#include "CEGLManager.h"
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_)
|
||||
#if defined(_IRR_COMPILE_WITH_GLX_MANAGER_)
|
||||
#include "CGLXManager.h"
|
||||
#endif
|
||||
|
||||
|
@ -69,24 +69,6 @@
|
|||
|
||||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
IVideoDriver *createOpenGLDriver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
IVideoDriver *createOGLES2Driver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WEBGL1_
|
||||
IVideoDriver *createWebGL1Driver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager);
|
||||
#endif
|
||||
}
|
||||
} // end namespace irr
|
||||
|
||||
namespace
|
||||
{
|
||||
Atom X_ATOM_CLIPBOARD;
|
||||
|
@ -397,10 +379,11 @@ bool CIrrDeviceLinux::createWindow()
|
|||
if (WMCheck != None)
|
||||
HasNetWM = true;
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_)
|
||||
#if defined(_IRR_COMPILE_WITH_GLX_MANAGER_)
|
||||
// don't use the XVisual with OpenGL, because it ignores all requested
|
||||
// properties of the CreationParams
|
||||
if (CreationParams.DriverType == video::EDT_OPENGL) {
|
||||
if (CreationParams.DriverType == video::EDT_OPENGL
|
||||
|| CreationParams.DriverType == video::EDT_OPENGL3) {
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
ContextManager = new video::CGLXManager(CreationParams, data, Screennr);
|
||||
|
@ -539,51 +522,54 @@ void CIrrDeviceLinux::createDriver()
|
|||
switch (CreationParams.DriverType) {
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
case video::EDT_OPENGL:
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
|
||||
#endif
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
#else
|
||||
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
|
||||
break;
|
||||
case video::EDT_OPENGL3:
|
||||
{
|
||||
#ifdef ENABLE_OPENGL3
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
#endif
|
||||
VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
break;
|
||||
case video::EDT_OGLES2:
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager = new video::CEGLManager();
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
|
||||
#endif
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
#else
|
||||
os::Printer::log("No OpenGL-ES2 support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
break;
|
||||
case video::EDT_WEBGL1:
|
||||
#ifdef _IRR_COMPILE_WITH_WEBGL1_
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_WEBGL1_
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = XWindow;
|
||||
data.OpenGLLinux.X11Display = XDisplay;
|
||||
|
||||
ContextManager = new video::CEGLManager();
|
||||
ContextManager->initialize(CreationParams, data);
|
||||
|
||||
#endif
|
||||
VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager);
|
||||
}
|
||||
#else
|
||||
os::Printer::log("No WebGL1 support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
break;
|
||||
case video::EDT_NULL:
|
||||
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
|
||||
|
@ -591,7 +577,7 @@ void CIrrDeviceLinux::createDriver()
|
|||
default:
|
||||
os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR);
|
||||
break;
|
||||
#else
|
||||
#else // no X11
|
||||
case video::EDT_NULL:
|
||||
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue