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. --- .../irrlicht-1.8/source/Irrlicht/CIrrDeviceLinux.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'libraries/irrlicht-1.8/source') 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