summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-02 19:33:01 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-02 19:33:01 +0300
commiteda234f5e156d376541044b351fd2e1e766700a3 (patch)
tree56ef425beb88fe84c280dea3a3ddeef676553589 /src/utils
parent5ce62dae5b3848833765a19296ffd9fd7e9721d8 (diff)
downloadmanaverse-eda234f5e156d376541044b351fd2e1e766700a3.tar.gz
manaverse-eda234f5e156d376541044b351fd2e1e766700a3.tar.bz2
manaverse-eda234f5e156d376541044b351fd2e1e766700a3.tar.xz
manaverse-eda234f5e156d376541044b351fd2e1e766700a3.zip
Fix resize in modernopengl with own context in SDL1.2 build.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/glxhelper.cpp9
-rw-r--r--src/utils/glxhelper.h6
-rw-r--r--src/utils/sdl2helper.cpp4
-rw-r--r--src/utils/sdl2helper.h2
-rw-r--r--src/utils/sdlhelper.cpp14
-rw-r--r--src/utils/sdlhelper.h2
6 files changed, 35 insertions, 2 deletions
diff --git a/src/utils/glxhelper.cpp b/src/utils/glxhelper.cpp
index 1fedeb9c6..1624b6309 100644
--- a/src/utils/glxhelper.cpp
+++ b/src/utils/glxhelper.cpp
@@ -36,7 +36,7 @@ static int ErrorHandler(Display *d A_UNUSED, XErrorEvent *e A_UNUSED)
return 0;
}
-void *GlxHelper::createContext(unsigned int window,
+void *GlxHelper::createContext(const unsigned int window,
void *const display0,
const int major,
const int minor)
@@ -117,4 +117,11 @@ void *GlxHelper::createContext(unsigned int window,
return context2;
}
+bool GlxHelper::makeCurrent(const unsigned int window,
+ void *const display,
+ void *const context)
+{
+ return mglXMakeCurrent(static_cast<Display*>(display), window, context);
+}
+
#endif // defined(USE_OPENGL) && defined(USE_X11)
diff --git a/src/utils/glxhelper.h b/src/utils/glxhelper.h
index 0378256d0..ce3a5568d 100644
--- a/src/utils/glxhelper.h
+++ b/src/utils/glxhelper.h
@@ -31,10 +31,14 @@
namespace GlxHelper
{
- void *createContext(unsigned int window,
+ void *createContext(const unsigned int window,
void *const display,
const int major,
const int minor);
+
+ bool makeCurrent(const unsigned int window,
+ void *const display,
+ void *const context);
} // namespace Glx
#endif // defined(USE_OPENGL) && defined(USE_X11)
diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp
index 3b2b988a0..07f8d965c 100644
--- a/src/utils/sdl2helper.cpp
+++ b/src/utils/sdl2helper.cpp
@@ -126,4 +126,8 @@ void *SDL::createGLContext(SDL_Window *const window,
return context;
}
+void SDL::makeCurrentContext(void *const context A_UNUSED)
+{
+}
+
#endif // USE_SDL2
diff --git a/src/utils/sdl2helper.h b/src/utils/sdl2helper.h
index 6f59b27a6..b7ab35d84 100644
--- a/src/utils/sdl2helper.h
+++ b/src/utils/sdl2helper.h
@@ -55,6 +55,8 @@ namespace SDL
void *createGLContext(SDL_Window *const window,
const int major,
const int minor);
+
+ void makeCurrentContext(void *const context);
} // namespace SDL
#endif // USE_SDL2
diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp
index 19cffa0a6..b809fd76b 100644
--- a/src/utils/sdlhelper.cpp
+++ b/src/utils/sdlhelper.cpp
@@ -140,6 +140,16 @@ void *SDL::createGLContext(SDL_Surface *const window A_UNUSED,
}
return context;
}
+
+void SDL::makeCurrentContext(void *const context)
+{
+ SDL_SysWMinfo info;
+ SDL_VERSION(&info.version);
+ SDL_GetWMInfo(&info);
+ GlxHelper::makeCurrent(info.info.x11.window,
+ info.info.x11.display,
+ context);
+}
#else
void *SDL::createGLContext(SDL_Surface *const window A_UNUSED,
const int major A_UNUSED,
@@ -147,6 +157,10 @@ void *SDL::createGLContext(SDL_Surface *const window A_UNUSED,
{
return nullptr;
}
+
+void SDL::makeCurrentContext(void *const context A_UNUSED)
+{
+}
#endif
#endif // USE_SDL2
diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h
index 328c093cd..92fcaba65 100644
--- a/src/utils/sdlhelper.h
+++ b/src/utils/sdlhelper.h
@@ -60,6 +60,8 @@ namespace SDL
void *createGLContext(SDL_Surface *const window A_UNUSED,
const int major,
const int minor);
+
+ void makeCurrentContext(void *const context);
} // namespace SDL
#endif // USE_SDL2