]> git.lizzy.rs Git - irrlicht.git/commitdiff
Merge branch 'master' into opengl3
authornumzero <numzer0@yandex.ru>
Fri, 3 Mar 2023 18:52:25 +0000 (21:52 +0300)
committernumzero <numzer0@yandex.ru>
Fri, 3 Mar 2023 19:01:30 +0000 (22:01 +0300)
1  2 
include/irrUString.h
source/Irrlicht/CIrrDeviceLinux.h
source/Irrlicht/CIrrDeviceSDL.cpp

diff --combined include/irrUString.h
index 61c36b85586f3a4f5bad3c675b625325b7331d3c,8e553fd747fc123c03e149f7ea3808bd757c578b..b0b730f0d82eefe91c103216883e04edf95e8603
@@@ -174,7 -174,7 +174,7 @@@ inline core::array<u8> getUnicodeBOM(EU
                        COPY_ARRAY(BOM_ENCODE_UTF8, BOM_ENCODE_UTF8_LEN);
                        break;
                case EUTFE_UTF16:
 -                      #ifdef __BIG_ENDIAN__
 +                      #if __BYTE_ORDER == __BIG_ENDIAN
                                COPY_ARRAY(BOM_ENCODE_UTF16_BE, BOM_ENCODE_UTF16_LEN);
                        #else
                                COPY_ARRAY(BOM_ENCODE_UTF16_LE, BOM_ENCODE_UTF16_LEN);
                        COPY_ARRAY(BOM_ENCODE_UTF16_LE, BOM_ENCODE_UTF16_LEN);
                        break;
                case EUTFE_UTF32:
 -                      #ifdef __BIG_ENDIAN__
 +                      #if __BYTE_ORDER == __BIG_ENDIAN
                                COPY_ARRAY(BOM_ENCODE_UTF32_BE, BOM_ENCODE_UTF32_LEN);
                        #else
                                COPY_ARRAY(BOM_ENCODE_UTF32_LE, BOM_ENCODE_UTF32_LEN);
@@@ -963,11 -963,11 +963,11 @@@ public
  #endif
  
                if (sizeof(wchar_t) == 4)
-                       append(reinterpret_cast<const uchar32_t* const>(c));
+                       append(reinterpret_cast<const uchar32_t*>(c));
                else if (sizeof(wchar_t) == 2)
-                       append(reinterpret_cast<const uchar16_t* const>(c));
+                       append(reinterpret_cast<const uchar16_t*>(c));
                else if (sizeof(wchar_t) == 1)
-                       append(reinterpret_cast<const uchar8_t* const>(c));
+                       append(reinterpret_cast<const uchar8_t*>(c));
        }
  
  
  #endif
  
                if (sizeof(wchar_t) == 4)
-                       append(reinterpret_cast<const uchar32_t* const>(c), length);
+                       append(reinterpret_cast<const uchar32_t*>(c), length);
                else if (sizeof(wchar_t) == 2)
-                       append(reinterpret_cast<const uchar16_t* const>(c), length);
+                       append(reinterpret_cast<const uchar16_t*>(c), length);
                else if (sizeof(wchar_t) == 1)
-                       append(reinterpret_cast<const uchar8_t* const>(c), length);
+                       append(reinterpret_cast<const uchar8_t*>(c), length);
        }
  
  
        ustring16& operator=(const wchar_t* const c)
        {
                if (sizeof(wchar_t) == 4)
-                       *this = reinterpret_cast<const uchar32_t* const>(c);
+                       *this = reinterpret_cast<const uchar32_t*>(c);
                else if (sizeof(wchar_t) == 2)
-                       *this = reinterpret_cast<const uchar16_t* const>(c);
+                       *this = reinterpret_cast<const uchar16_t*>(c);
                else if (sizeof(wchar_t) == 1)
-                       *this = reinterpret_cast<const uchar8_t* const>(c);
+                       *this = reinterpret_cast<const uchar8_t*>(c);
  
                return *this;
        }
  
        //! Gets the encoding of the Unicode string this class contains.
        //! \return An enum describing the current encoding of this string.
-       const unicode::EUTF_ENCODE getEncoding() const
+       unicode::EUTF_ENCODE getEncoding() const
        {
                return encoding;
        }
  
        //! Gets the endianness of the Unicode string this class contains.
        //! \return An enum describing the endianness of this string.
-       const unicode::EUTF_ENDIAN getEndianness() const
+       unicode::EUTF_ENDIAN getEndianness() const
        {
                if (encoding == unicode::EUTFE_UTF16_LE ||
                        encoding == unicode::EUTFE_UTF32_LE)
@@@ -3612,33 -3612,5 +3612,5 @@@ inline std::wostream& operator<<(std::w
        return out;
  }
  
- namespace unicode
- {
- //! Hashing algorithm for hashing a ustring.  Used for things like unordered_maps.
- //! Algorithm taken from std::hash<std::string>.
- class hash : public std::unary_function<core::ustring, size_t>
- {
-       public:
-               size_t operator()(const core::ustring& s) const
-               {
-                       size_t ret = 2166136261U;
-                       size_t index = 0;
-                       size_t stride = 1 + s.size_raw() / 10;
-                       core::ustring::const_iterator i = s.begin();
-                       while (i != s.end())
-                       {
-                               // TODO: Don't force u32 on an x64 OS.  Make it agnostic.
-                               ret = 16777619U * ret ^ (size_t)s[(u32)index];
-                               index += stride;
-                               i += stride;
-                       }
-                       return (ret);
-               }
- };
- } // end namespace unicode
  } // end namespace core
  } // end namespace irr
index 45d3f10ccea12136aad55655d3903872d66e6633,ea50d7c78b6a3dcfbbd9cda464b790ca181d31c0..2d8945c9b5d907911bde4fc9836fb8da8c3a4090
@@@ -5,6 -5,7 +5,6 @@@
  #ifndef __C_IRR_DEVICE_LINUX_H_INCLUDED__\r
  #define __C_IRR_DEVICE_LINUX_H_INCLUDED__\r
  \r
 -#include "IrrCompileConfig.h"\r
  \r
  #ifdef _IRR_COMPILE_WITH_X11_DEVICE_\r
  \r
@@@ -413,6 -414,9 +413,9 @@@ namespace ir
                bool HasNetWM;\r
                // text is utf-8\r
                mutable core::stringc Clipboard;\r
+ #endif\r
+ #if defined(_IRR_LINUX_X11_XINPUT2_)\r
+               int currentTouchedCount;\r
  #endif\r
                u32 Width, Height;\r
                bool WindowHasFocus;\r
                };\r
                core::array<JoystickInfo> ActiveJoysticks;\r
  #endif\r
\r
- #if defined(_IRR_LINUX_X11_XINPUT2_)\r
-               int currentTouchedCount;\r
- #endif\r
        };\r
  \r
  \r
index ecd8a8da1352bdcceb66bfe9e1275eb75e4748f6,1af434b8ce015ac6ee6622dec3069271c0f1ea8a..b0c774797be01d5793304d12c05a187e9bae9b1a
@@@ -2,6 -2,7 +2,6 @@@
  // This file is part of the "Irrlicht Engine".\r
  // For conditions of distribution and use, see copyright notice in irrlicht.h\r
  \r
 -#include "IrrCompileConfig.h"\r
  \r
  #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_\r
  \r
  #include <SDL_video.h>\r
  \r
  #ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
 -#ifdef _IRR_COMPILE_WITH_OGLES2_\r
 -#include "CEGLManager.h"\r
 -#endif\r
  #include <emscripten.h>\r
  #endif\r
  \r
 -#ifdef _IRR_COMPILE_WITH_OPENGL_\r
  #include "CSDLManager.h"\r
 -#endif\r
  \r
  static int SDLDeviceInstances = 0;\r
  \r
@@@ -33,42 -39,14 +33,42 @@@ namespace ir
        {\r
                #ifdef _IRR_COMPILE_WITH_OPENGL_\r
                IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
 +              #else\r
 +              static IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)\r
 +              {\r
 +                      os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);\r
 +                      return nullptr;\r
 +              }\r
 +              #endif\r
 +\r
 +              #ifdef ENABLE_OPENGL3\r
 +              IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
 +              #else\r
 +              static IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)\r
 +              {\r
 +                      os::Printer::log("No OpenGL 3 support compiled in.", ELL_ERROR);\r
 +                      return nullptr;\r
 +              }\r
                #endif\r
  \r
                #ifdef _IRR_COMPILE_WITH_OGLES2_\r
                IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
 +              #else\r
 +              static IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)\r
 +              {\r
 +                      os::Printer::log("No OpenGL ES 2 support compiled in.", ELL_ERROR);\r
 +                      return nullptr;\r
 +              }\r
                #endif\r
  \r
                #ifdef _IRR_COMPILE_WITH_WEBGL1_\r
                IVideoDriver* createWebGL1Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
 +              #else\r
 +              static IVideoDriver* createWebGL1Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)\r
 +              {\r
 +                      os::Printer::log("No WebGL 1 support compiled in.", ELL_ERROR);\r
 +                      return nullptr;\r
 +              }\r
                #endif\r
        } // end namespace video\r
  \r
@@@ -255,6 -233,28 +255,6 @@@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrr
        // create keymap\r
        createKeyMap();\r
  \r
 -      if (CreationParams.Fullscreen) {\r
 -#ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
 -              SDL_Flags |= SDL_WINDOW_FULLSCREEN;\r
 -#else\r
 -              SDL_Flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;\r
 -#endif\r
 -      }\r
 -      if (Resizable)\r
 -              SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
 -      if (CreationParams.WindowMaximized)\r
 -              SDL_Flags |= SDL_WINDOW_MAXIMIZED;\r
 -\r
 -      if (CreationParams.DriverType == video::EDT_OPENGL)\r
 -      {\r
 -              SDL_Flags |= SDL_WINDOW_OPENGL;\r
 -              if (!CreationParams.Doublebuffer)\r
 -                      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);\r
 -      }\r
 -#ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
 -      SDL_Flags |= SDL_WINDOW_OPENGL;\r
 -#endif //_IRR_EMSCRIPTEN_PLATFORM_\r
 -\r
        // create window\r
        if (CreationParams.DriverType != video::EDT_NULL)\r
        {\r
@@@ -344,16 -344,6 +344,19 @@@ void CIrrDeviceSDL::logAttributes(
  \r
  bool CIrrDeviceSDL::createWindow()\r
  {\r
-       } else  {\r
-               if (Resizable)\r
-                       SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
-               if (CreationParams.WindowMaximized)\r
-                       SDL_Flags |= SDL_WINDOW_MAXIMIZED;\r
 +      if (CreationParams.Fullscreen) {\r
++#ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
 +              SDL_Flags |= SDL_WINDOW_FULLSCREEN;\r
++#else\r
++              SDL_Flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;\r
++#endif\r
 +      }\r
++      if (Resizable)\r
++              SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
++      if (CreationParams.WindowMaximized)\r
++              SDL_Flags |= SDL_WINDOW_MAXIMIZED;\r
 +      SDL_Flags |= SDL_WINDOW_OPENGL;\r
 +\r
  #ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
        if ( Width != 0 || Height != 0 )\r
                emscripten_set_canvas_size( Width, Height);\r
        if ( Close )\r
                return false;\r
  \r
 -      if (CreationParams.DriverType == video::EDT_OPENGL) {\r
 -              if (CreationParams.Bits == 16) {\r
 -                      SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 4);\r
 -                      SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 4);\r
 -                      SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 4);\r
 -                      SDL_GL_SetAttribute(\r
 -                                      SDL_GL_ALPHA_SIZE, CreationParams.WithAlphaChannel ? 1 : 0);\r
 -              } else {\r
 -                      SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);\r
 -                      SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);\r
 -                      SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);\r
 -                      SDL_GL_SetAttribute(\r
 -                                      SDL_GL_ALPHA_SIZE, CreationParams.WithAlphaChannel ? 8 : 0);\r
 -              }\r
 -              SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, CreationParams.ZBufferBits);\r
 -              if (CreationParams.Doublebuffer)\r
 -                      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);\r
 -              SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, CreationParams.Stencilbuffer ? 8 : 0);\r
 -              if (CreationParams.Stereobuffer)\r
 -                      SDL_GL_SetAttribute(SDL_GL_STEREO, 1);\r
 -              if (CreationParams.AntiAlias > 1) {\r
 -                      SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);\r
 +      switch (CreationParams.DriverType) {\r
 +              case video::EDT_OPENGL:\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);\r
 +                      break;\r
 +              case video::EDT_OPENGL3:\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);\r
 +                      break;\r
 +              case video::EDT_OGLES1:\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);\r
 +                      break;\r
 +              case video::EDT_OGLES2:\r
 +              case video::EDT_WEBGL1:\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);\r
 +                      SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);\r
 +                      break;\r
 +              default:;\r
 +      }\r
 +\r
 +#ifdef _DEBUG\r
 +      SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG);\r
 +#endif\r
 +\r
 +      if (CreationParams.Bits == 16) {\r
 +              SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);\r
 +              SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);\r
 +              SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);\r
 +              SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, CreationParams.WithAlphaChannel ? 1 : 0);\r
 +      } else {\r
 +              SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);\r
 +              SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);\r
 +              SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);\r
 +              SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, CreationParams.WithAlphaChannel ? 8 : 0);\r
 +      }\r
 +      SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, CreationParams.ZBufferBits);\r
 +      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, CreationParams.Doublebuffer);\r
 +      SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, CreationParams.Stencilbuffer ? 8 : 0);\r
 +      SDL_GL_SetAttribute(SDL_GL_STEREO, CreationParams.Stereobuffer);\r
 +      if (CreationParams.AntiAlias > 1) {\r
 +              SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);\r
 +              SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, CreationParams.AntiAlias);\r
 +      }\r
 +      if (!Window)\r
 +              Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 +      if (!Window) {\r
 +              os::Printer::log("Could not create window...", SDL_GetError(), ELL_WARNING);\r
 +      }\r
 +      if (!Window && CreationParams.AntiAlias > 1) {\r
 +              while (--CreationParams.AntiAlias > 1) {\r
                        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, CreationParams.AntiAlias);\r
 -              }\r
 -              if (!Window)\r
                        Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 -              if (!Window && CreationParams.AntiAlias > 1) {\r
 -                      while (--CreationParams.AntiAlias > 1) {\r
 -                              SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, CreationParams.AntiAlias);\r
 -                              Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 -                              if (Window)\r
 -                                      break;\r
 -                      }\r
 -                      if (!Window) {\r
 -                              SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);\r
 -                              SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);\r
 -                              Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 -                              if (Window)\r
 -                                      os::Printer::log("AntiAliasing disabled due to lack of support!");\r
 -                      }\r
 +                      if (Window)\r
 +                              break;\r
                }\r
 -\r
 -              if (Window)\r
 -              {\r
 -                      Context = SDL_GL_CreateContext(Window);\r
 +              if (!Window) {\r
 +                      SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);\r
 +                      SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);\r
 +                      Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 +                      if (Window)\r
 +                              os::Printer::log("AntiAliasing disabled due to lack of support!", ELL_WARNING);\r
                }\r
 -      } else if (!Window)\r
 -              Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 +      }\r
  \r
        if ( !Window && CreationParams.Doublebuffer)\r
        {\r
        }\r
        if ( !Window )\r
        {\r
 -              os::Printer::log( "Could not initialize display!" );\r
 +              os::Printer::log("Could not initialize display", SDL_GetError(), ELL_ERROR);\r
 +              return false;\r
 +      }\r
 +\r
 +      Context = SDL_GL_CreateContext(Window);\r
 +      if (!Context) {\r
 +              os::Printer::log("Could not initialize context", SDL_GetError(), ELL_ERROR);\r
 +              SDL_DestroyWindow(Window);\r
                return false;\r
        }\r
  \r
  //! create the driver\r
  void CIrrDeviceSDL::createDriver()\r
  {\r
 -      switch(CreationParams.DriverType)\r
 -      {\r
 -      case video::DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS:\r
 -              os::Printer::log("DIRECT3D8 Driver is no longer supported in Irrlicht. Try another one.", ELL_ERROR);\r
 -              break;\r
 -\r
 -      case video::EDT_DIRECT3D9:\r
 -              #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_\r
 -              os::Printer::log("SDL device does not support DIRECT3D9 driver. Try another one.", ELL_ERROR);\r
 -              #else\r
 -              os::Printer::log("DIRECT3D9 Driver was not compiled into this dll. Try another one.", ELL_ERROR);\r
 -              #endif // _IRR_COMPILE_WITH_DIRECT3D_9_\r
 -\r
 -              break;\r
 -\r
 -      case video::EDT_OPENGL:\r
 -              #ifdef _IRR_COMPILE_WITH_OPENGL_\r
 -              ContextManager = new video::CSDLManager(this);\r
 -              VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);\r
 -              #else\r
 -              os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);\r
 -              #endif\r
 -              break;\r
 -\r
 -      case video::EDT_OGLES2:\r
 -#if defined(_IRR_COMPILE_WITH_OGLES2_) && defined(_IRR_EMSCRIPTEN_PLATFORM_)\r
 -              {\r
 -                      video::SExposedVideoData data;\r
 -\r
 -                      ContextManager = new video::CEGLManager();\r
 -                      ContextManager->initialize(CreationParams, data);\r
 -\r
 -                      VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);\r
 -              }\r
 -#else\r
 -              os::Printer::log("No OpenGL-ES2 support compiled in.", ELL_ERROR);\r
 -#endif\r
 -              break;\r
 -\r
 -      case video::EDT_WEBGL1:\r
 -#if defined(_IRR_COMPILE_WITH_WEBGL1_) && defined(_IRR_EMSCRIPTEN_PLATFORM_)\r
 -              {\r
 -                      video::SExposedVideoData data;\r
 -\r
 -                      ContextManager = new video::CEGLManager();\r
 -                      ContextManager->initialize(CreationParams, data);\r
 -\r
 -                      VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager);\r
 -              }\r
 -#else\r
 -              os::Printer::log("No WebGL1 support compiled in.", ELL_ERROR);\r
 -#endif\r
 -              break;\r
 -\r
 -      case video::EDT_NULL:\r
 +      if (CreationParams.DriverType == video::EDT_NULL) {\r
                VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);\r
 -              break;\r
 -\r
 -      default:\r
 -              os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR);\r
 -              break;\r
 +              return;\r
        }\r
  \r
 -      // In case we got the size from the canvas\r
 -      if ( VideoDriver && CreationParams.WindowSize.Width == 0 && CreationParams.WindowSize.Height == 0 && Width > 0 && Height > 0 )\r
 +      ContextManager = new video::CSDLManager(this);\r
 +      switch(CreationParams.DriverType)\r
        {\r
 -#ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
 -              SDL_CreateWindowAndRenderer(Width, Height, SDL_Flags, &Window, &Renderer);\r
 -#else //_IRR_EMSCRIPTEN_PLATFORM_\r
 -              Window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_Flags);\r
 -#endif //_IRR_EMSCRIPTEN_PLATFOR\r
 -              VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));\r
 +      case video::EDT_OPENGL: VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager); break;\r
 +      case video::EDT_OPENGL3: VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager); break;\r
 +      case video::EDT_OGLES2: VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager); break;\r
 +      case video::EDT_WEBGL1: VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager); break;\r
 +      default:;\r
        }\r
 +      if (!VideoDriver)\r
 +              os::Printer::log("Could not create video driver", ELL_ERROR);\r
  }\r
  \r
  \r