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