|
@@ -1220,7 +1220,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SDL_Window *
|
|
SDL_Window *
|
|
|
-SDL_CreateWindowFrom(const void *data)
|
|
|
|
|
|
|
+SDL_CreateWindowFrom(const void *data, Uint32 flags)
|
|
|
{
|
|
{
|
|
|
SDL_Window *window;
|
|
SDL_Window *window;
|
|
|
|
|
|
|
@@ -1239,6 +1239,16 @@ SDL_CreateWindowFrom(const void *data)
|
|
|
}
|
|
}
|
|
|
_this->windows = window;
|
|
_this->windows = window;
|
|
|
|
|
|
|
|
|
|
+ // Urho3D: load OpenGL if initializing an external OpenGL window
|
|
|
|
|
+ if (flags & SDL_WINDOW_OPENGL) {
|
|
|
|
|
+ if (!_this->GL_CreateContext) {
|
|
|
|
|
+ SDL_SetError("No OpenGL support in video driver");
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ SDL_GL_LoadLibrary(NULL);
|
|
|
|
|
+ window->flags |= SDL_WINDOW_OPENGL;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!_this->CreateWindowFrom ||
|
|
if (!_this->CreateWindowFrom ||
|
|
|
_this->CreateWindowFrom(_this, window, data) < 0) {
|
|
_this->CreateWindowFrom(_this, window, data) < 0) {
|
|
|
SDL_DestroyWindow(window);
|
|
SDL_DestroyWindow(window);
|
|
@@ -2511,22 +2521,9 @@ SDL_GL_CreateContext(SDL_Window * window)
|
|
|
SDL_GLContext ctx = NULL;
|
|
SDL_GLContext ctx = NULL;
|
|
|
CHECK_WINDOW_MAGIC(window, NULL);
|
|
CHECK_WINDOW_MAGIC(window, NULL);
|
|
|
|
|
|
|
|
- // Urho3D: set up OpenGL support dynamically if necessary for external windows
|
|
|
|
|
if (!(window->flags & SDL_WINDOW_OPENGL)) {
|
|
if (!(window->flags & SDL_WINDOW_OPENGL)) {
|
|
|
- #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__
|
|
|
|
|
- window->flags |= SDL_WINDOW_OPENGL;
|
|
|
|
|
- #else
|
|
|
|
|
- window->flags |= SDL_WINDOW_OPENGL;
|
|
|
|
|
- if (!_this->GL_CreateContext) {
|
|
|
|
|
- SDL_SetError("No OpenGL support in video driver");
|
|
|
|
|
- return NULL;
|
|
|
|
|
- }
|
|
|
|
|
- SDL_GL_LoadLibrary(NULL);
|
|
|
|
|
- #endif
|
|
|
|
|
- /*
|
|
|
|
|
SDL_SetError("The specified window isn't an OpenGL window");
|
|
SDL_SetError("The specified window isn't an OpenGL window");
|
|
|
return NULL;
|
|
return NULL;
|
|
|
- */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ctx = _this->GL_CreateContext(_this, window);
|
|
ctx = _this->GL_CreateContext(_this, window);
|