From 8772dabfcdf0d7ade826f213b7ae887615e7ee3f Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 13 Jan 2013 17:41:10 +1000 Subject: Let Irrlicht use an externally created OpenGL context and surface. Linux only for now. Others can come later. --- libraries/irrlicht-1.8/include/SIrrCreationParameters.h | 5 +++++ .../irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'libraries') diff --git a/libraries/irrlicht-1.8/include/SIrrCreationParameters.h b/libraries/irrlicht-1.8/include/SIrrCreationParameters.h index cbf558d..89dff19 100644 --- a/libraries/irrlicht-1.8/include/SIrrCreationParameters.h +++ b/libraries/irrlicht-1.8/include/SIrrCreationParameters.h @@ -9,6 +9,7 @@ #include "EDeviceTypes.h" #include "dimension2d.h" #include "ILogger.h" +#include "SExposedVideoData.h" namespace irr { @@ -37,6 +38,7 @@ namespace irr HighPrecisionFPU(false), EventReceiver(0), WindowId(0), + VideoData(0), #ifdef _DEBUG LoggingLevel(ELL_DEBUG), #else @@ -72,6 +74,7 @@ namespace irr HighPrecisionFPU = other.HighPrecisionFPU; EventReceiver = other.EventReceiver; WindowId = other.WindowId; + VideoData = other.VideoData; LoggingLevel = other.LoggingLevel; DriverMultithreaded = other.DriverMultithreaded; DisplayAdapter = other.DisplayAdapter; @@ -258,6 +261,8 @@ namespace irr do it how you like. */ void* WindowId; + video::SExposedVideoData *VideoData; + //! Specifies the logging level used in the logging interface. /** The default value is ELL_INFORMATION. You can access the ILogger interface later on from the IrrlichtDevice with getLogger() and set another level. diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp index f9d2d00..6339b6a 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp @@ -375,7 +375,10 @@ bool CIrrDeviceLinux::createWindow() XSetErrorHandler(IrrPrintXError); #endif - display = XOpenDisplay(0); + if (CreationParams.VideoData) + display = (Display *) CreationParams.VideoData->OpenGLLinux.X11Display; + if (!display) + display = XOpenDisplay(0); if (!display) { os::Printer::log("Error: Need running XServer to start Irrlicht Engine.", ELL_ERROR); @@ -719,7 +722,17 @@ bool CIrrDeviceLinux::createWindow() Context=0; if (isAvailableGLX && CreationParams.DriverType==video::EDT_OPENGL) { - if (UseGLXWindow) + if (CreationParams.VideoData) + Context = (GLXContext) CreationParams.VideoData->OpenGLLinux.X11Context; + if (Context) + { + if (!glXMakeCurrent(display, window, Context)) + { + os::Printer::log("Could not make context current.", ELL_WARNING); + glXDestroyContext(display, Context); + } + } + else if (UseGLXWindow) { glxWin=glXCreateWindow(display,glxFBConfig,window,NULL); if (glxWin) -- cgit v1.1