Commit 97577f9b authored by hybrid's avatar hybrid

Push creation parameters to video drivers.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1378 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6fae1424
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
namespace irr namespace irr
{ {
class IEventReceiver;
//! Structure for holding Irrlicht Device creation parameters. //! Structure for holding Irrlicht Device creation parameters.
/** This structure is used in the createDeviceEx() function. */ /** This structure is used in the createDeviceEx() function. */
struct SIrrlichtCreationParameters struct SIrrlichtCreationParameters
......
...@@ -24,8 +24,8 @@ namespace irr ...@@ -24,8 +24,8 @@ namespace irr
{ {
namespace video namespace video
{ {
IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias); io::IFileSystem* io);
} }
} // end namespace irr } // end namespace irr
...@@ -637,7 +637,7 @@ void CIrrDeviceLinux::createDriver() ...@@ -637,7 +637,7 @@ void CIrrDeviceLinux::createDriver()
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
if (Context) if (Context)
VideoDriver = video::createOpenGLDriver(CreationParams.WindowSize, CreationParams.Fullscreen, CreationParams.Stencilbuffer, FileSystem, CreationParams.Vsync, CreationParams.AntiAlias); VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem);
#else #else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif #endif
......
...@@ -23,8 +23,8 @@ namespace irr ...@@ -23,8 +23,8 @@ namespace irr
{ {
namespace video namespace video
{ {
IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias); io::IFileSystem* io);
} }
} // end namespace irr } // end namespace irr
...@@ -173,7 +173,7 @@ void CIrrDeviceSDL::createDriver() ...@@ -173,7 +173,7 @@ void CIrrDeviceSDL::createDriver()
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
VideoDriver = video::createOpenGLDriver(CreationParams.WindowSize, CreationParams.Fullscreen, CreationParams.Stencilbuffer, FileSystem, CreationParams.Vsync, CreationParams.AntiAlias); VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem);
#else #else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif #endif
......
...@@ -184,12 +184,11 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, ...@@ -184,12 +184,11 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize,
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#ifdef _IRR_USE_LINUX_DEVICE_ #ifdef _IRR_USE_LINUX_DEVICE_
//! Linux constructor and init code //! Linux constructor and init code
COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
bool fullscreen, bool stencilBuffer, io::IFileSystem* io, io::IFileSystem* io)
bool vsync, bool antiAlias) : CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(antiAlias), Transformation3DChanged(true), AntiAlias(params.AntiAlias),
RenderTargetTexture(0), LastSetLight(-1), CurrentRendertargetSize(0,0) RenderTargetTexture(0), LastSetLight(-1), CurrentRendertargetSize(0,0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -199,15 +198,16 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, ...@@ -199,15 +198,16 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize,
XDisplay = glXGetCurrentDisplay(); XDisplay = glXGetCurrentDisplay();
ExposedData.OpenGLLinux.X11Display = XDisplay; ExposedData.OpenGLLinux.X11Display = XDisplay;
ExposedData.OpenGLLinux.X11Window = XWindow; ExposedData.OpenGLLinux.X11Window = XWindow;
genericDriverInit(screenSize, stencilBuffer);
genericDriverInit(params.WindowSize, params.Stencilbuffer);
// set vsync // set vsync
#ifdef GLX_SGI_swap_control #ifdef GLX_SGI_swap_control
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (vsync && glxSwapIntervalSGI) if (params.Vsync && glxSwapIntervalSGI)
glxSwapIntervalSGI(1); glxSwapIntervalSGI(1);
#else #else
if (vsync) if (params.Vsync)
glXSwapIntervalSGI(1); glXSwapIntervalSGI(1);
#endif #endif
#endif #endif
...@@ -221,19 +221,18 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, ...@@ -221,19 +221,18 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize,
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#ifdef _IRR_USE_SDL_DEVICE_ #ifdef _IRR_USE_SDL_DEVICE_
//! SDL constructor and init code //! SDL constructor and init code
COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
bool fullscreen, bool stencilBuffer, io::IFileSystem* io, io::IFileSystem* io)
bool vsync, bool antiAlias) : CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(antiAlias), Transformation3DChanged(true), AntiAlias(params.AntiAlias),
RenderTargetTexture(0), LastSetLight(-1), CurrentRendertargetSize(0,0) RenderTargetTexture(0), LastSetLight(-1), CurrentRendertargetSize(0,0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLDriver"); setDebugName("COpenGLDriver");
#endif #endif
genericDriverInit(screenSize, stencilBuffer); genericDriverInit(params.WindowSize, params.Stencilbuffer);
} }
#endif // _IRR_USE_SDL_DEVICE_ #endif // _IRR_USE_SDL_DEVICE_
...@@ -2741,38 +2740,20 @@ IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize, ...@@ -2741,38 +2740,20 @@ IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize,
#endif // _IRR_USE_OSX_DEVICE_ #endif // _IRR_USE_OSX_DEVICE_
// ----------------------------------- // -----------------------------------
// LINUX VERSION // X11/SDL VERSION
// ----------------------------------- // -----------------------------------
#ifdef _IRR_USE_LINUX_DEVICE_ #if defined(_IRR_USE_LINUX_DEVICE_) || defined(_IRR_USE_SDL_DEVICE_)
IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias) io::IFileSystem* io)
{ {
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
return new COpenGLDriver(screenSize, fullscreen, stencilBuffer, return new COpenGLDriver(params, io);
io, vsync, antiAlias);
#else #else
return 0; return 0;
#endif // _IRR_COMPILE_WITH_OPENGL_ #endif // _IRR_COMPILE_WITH_OPENGL_
} }
#endif // _IRR_USE_LINUX_DEVICE_ #endif // _IRR_USE_LINUX_DEVICE_
// -----------------------------------
// SDL VERSION
// -----------------------------------
#ifdef _IRR_USE_SDL_DEVICE_
IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize,
bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias)
{
#ifdef _IRR_COMPILE_WITH_OPENGL_
return new COpenGLDriver(screenSize, fullscreen, stencilBuffer,
io, vsync, antiAlias);
#else
return 0;
#endif // _IRR_COMPILE_WITH_OPENGL_
}
#endif // _IRR_USE_SDL_DEVICE_
} // end namespace } // end namespace
} // end namespace } // end namespace
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "CNullDriver.h" #include "CNullDriver.h"
#include "IMaterialRendererServices.h" #include "IMaterialRendererServices.h"
#include "COpenGLExtensionHandler.h" #include "COpenGLExtensionHandler.h"
#include "SIrrCreationParameters.h"
#if defined(_IRR_WINDOWS_API_) #if defined(_IRR_WINDOWS_API_)
// include windows headers for HWND // include windows headers for HWND
...@@ -40,8 +41,8 @@ ...@@ -40,8 +41,8 @@
#define GL_GLEXT_PROTOTYPES 1 #define GL_GLEXT_PROTOTYPES 1
#define GLX_GLXEXT_PROTOTYPES 1 #define GLX_GLXEXT_PROTOTYPES 1
#endif #endif
#include <SDL/SDL_opengl.h>
#define NO_SDL_GLEXT #define NO_SDL_GLEXT
#include <SDL/SDL_opengl.h>
#include "glext.h" #include "glext.h"
#else #else
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
...@@ -80,9 +81,8 @@ namespace video ...@@ -80,9 +81,8 @@ namespace video
u32 bits, bool fullscreen, bool vsync, bool stencilBuffer); u32 bits, bool fullscreen, bool vsync, bool stencilBuffer);
#endif #endif
#ifdef _IRR_USE_LINUX_DEVICE_ #if defined(_IRR_USE_LINUX_DEVICE_) || defined(_IRR_USE_SDL_DEVICE_)
COpenGLDriver(const core::dimension2d<s32>& screenSize, bool fullscreen, COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io);
bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias);
#endif #endif
#ifdef _IRR_USE_OSX_DEVICE_ #ifdef _IRR_USE_OSX_DEVICE_
...@@ -90,11 +90,6 @@ namespace video ...@@ -90,11 +90,6 @@ namespace video
bool stencilBuffer, CIrrDeviceMacOSX *device,io::IFileSystem* io, bool vsync, bool antiAlias); bool stencilBuffer, CIrrDeviceMacOSX *device,io::IFileSystem* io, bool vsync, bool antiAlias);
#endif #endif
#ifdef _IRR_USE_SDL_DEVICE_
COpenGLDriver(const core::dimension2d<s32>& screenSize, bool fullscreen,
bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias);
#endif
//! destructor //! destructor
virtual ~COpenGLDriver(); virtual ~COpenGLDriver();
......
...@@ -38,8 +38,9 @@ ...@@ -38,8 +38,9 @@
#define GL_GLEXT_PROTOTYPES 1 #define GL_GLEXT_PROTOTYPES 1
#define GLX_GLXEXT_PROTOTYPES 1 #define GLX_GLXEXT_PROTOTYPES 1
#endif #endif
#include <SDL/SDL_opengl.h>
#define NO_SDL_GLEXT #define NO_SDL_GLEXT
#include <SDL/SDL_video.h>
#include <SDL/SDL_opengl.h>
#include "glext.h" #include "glext.h"
#else #else
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment