aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 17:41:10 +1000
committerDavid Walter Seikel2013-01-13 17:41:10 +1000
commit8772dabfcdf0d7ade826f213b7ae887615e7ee3f (patch)
tree9258e6a4f76127577cf958e05211732f8973ac4f
parentIgnore Irrlicht built files. (diff)
downloadSledjHamr-8772dabfcdf0d7ade826f213b7ae887615e7ee3f.zip
SledjHamr-8772dabfcdf0d7ade826f213b7ae887615e7ee3f.tar.gz
SledjHamr-8772dabfcdf0d7ade826f213b7ae887615e7ee3f.tar.bz2
SledjHamr-8772dabfcdf0d7ade826f213b7ae887615e7ee3f.tar.xz
Let Irrlicht use an externally created OpenGL context and surface.
Linux only for now. Others can come later.
-rw-r--r--libraries/irrlicht-1.8/include/SIrrCreationParameters.h5
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp17
2 files changed, 20 insertions, 2 deletions
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 @@
9#include "EDeviceTypes.h" 9#include "EDeviceTypes.h"
10#include "dimension2d.h" 10#include "dimension2d.h"
11#include "ILogger.h" 11#include "ILogger.h"
12#include "SExposedVideoData.h"
12 13
13namespace irr 14namespace irr
14{ 15{
@@ -37,6 +38,7 @@ namespace irr
37 HighPrecisionFPU(false), 38 HighPrecisionFPU(false),
38 EventReceiver(0), 39 EventReceiver(0),
39 WindowId(0), 40 WindowId(0),
41 VideoData(0),
40#ifdef _DEBUG 42#ifdef _DEBUG
41 LoggingLevel(ELL_DEBUG), 43 LoggingLevel(ELL_DEBUG),
42#else 44#else
@@ -72,6 +74,7 @@ namespace irr
72 HighPrecisionFPU = other.HighPrecisionFPU; 74 HighPrecisionFPU = other.HighPrecisionFPU;
73 EventReceiver = other.EventReceiver; 75 EventReceiver = other.EventReceiver;
74 WindowId = other.WindowId; 76 WindowId = other.WindowId;
77 VideoData = other.VideoData;
75 LoggingLevel = other.LoggingLevel; 78 LoggingLevel = other.LoggingLevel;
76 DriverMultithreaded = other.DriverMultithreaded; 79 DriverMultithreaded = other.DriverMultithreaded;
77 DisplayAdapter = other.DisplayAdapter; 80 DisplayAdapter = other.DisplayAdapter;
@@ -258,6 +261,8 @@ namespace irr
258 do it how you like. */ 261 do it how you like. */
259 void* WindowId; 262 void* WindowId;
260 263
264 video::SExposedVideoData *VideoData;
265
261 //! Specifies the logging level used in the logging interface. 266 //! Specifies the logging level used in the logging interface.
262 /** The default value is ELL_INFORMATION. You can access the ILogger interface 267 /** The default value is ELL_INFORMATION. You can access the ILogger interface
263 later on from the IrrlichtDevice with getLogger() and set another level. 268 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()
375 XSetErrorHandler(IrrPrintXError); 375 XSetErrorHandler(IrrPrintXError);
376#endif 376#endif
377 377
378 display = XOpenDisplay(0); 378 if (CreationParams.VideoData)
379 display = (Display *) CreationParams.VideoData->OpenGLLinux.X11Display;
380 if (!display)
381 display = XOpenDisplay(0);
379 if (!display) 382 if (!display)
380 { 383 {
381 os::Printer::log("Error: Need running XServer to start Irrlicht Engine.", ELL_ERROR); 384 os::Printer::log("Error: Need running XServer to start Irrlicht Engine.", ELL_ERROR);
@@ -719,7 +722,17 @@ bool CIrrDeviceLinux::createWindow()
719 Context=0; 722 Context=0;
720 if (isAvailableGLX && CreationParams.DriverType==video::EDT_OPENGL) 723 if (isAvailableGLX && CreationParams.DriverType==video::EDT_OPENGL)
721 { 724 {
722 if (UseGLXWindow) 725 if (CreationParams.VideoData)
726 Context = (GLXContext) CreationParams.VideoData->OpenGLLinux.X11Context;
727 if (Context)
728 {
729 if (!glXMakeCurrent(display, window, Context))
730 {
731 os::Printer::log("Could not make context current.", ELL_WARNING);
732 glXDestroyContext(display, Context);
733 }
734 }
735 else if (UseGLXWindow)
723 { 736 {
724 glxWin=glXCreateWindow(display,glxFBConfig,window,NULL); 737 glxWin=glXCreateWindow(display,glxFBConfig,window,NULL);
725 if (glxWin) 738 if (glxWin)