diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-08 00:46:19 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-08 00:47:32 +0400 |
commit | 8d084e8c8f48dd2f07d4a3fbd4a941a7bcc0dcfb (patch) | |
tree | 5bf15f4f74f3e5a307cfa3f734b2cd086dca69bd /source/gameengine/GamePlayer | |
parent | a8705e99ee8ec9de2f25c3bac1e9895c2f98c224 (diff) |
Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
Diffstat (limited to 'source/gameengine/GamePlayer')
9 files changed, 26 insertions, 34 deletions
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index fd73b4efb53..e6c980de566 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -47,6 +47,7 @@ set(INC ../../../blender/makesdna ../../../../intern/container ../../../../intern/ghost + ../../../../intern/glew-mx ../../../../intern/guardedalloc ../../../../intern/string ) @@ -69,6 +70,6 @@ set(SRC GPC_MouseDevice.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h index bd50066a212..338f9647b3e 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.h +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h @@ -40,7 +40,7 @@ # include <windows.h> #endif /* WIN32 */ -#include "GL/glew.h" +#include "glew-mx.h" #include <map> diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript index e30c2eb5859..b8fb9cbd2e2 100644 --- a/source/gameengine/GamePlayer/common/SConscript +++ b/source/gameengine/GamePlayer/common/SConscript @@ -64,12 +64,11 @@ incs = [ '#source/blender/misc', '#source/blender/blenloader', '#source/blender/gpu', - '#extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', ] -defs = [ - 'GLEW_STATIC', - ] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: incs.extend(Split(env['BF_PYTHON_INC'])) diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index df752799c2c..8ab090eac02 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -48,6 +48,7 @@ set(INC ../../../blender/makesrna ../../../../intern/container ../../../../intern/ghost + ../../../../intern/glew-mx ../../../../intern/guardedalloc ../../../../intern/string ../../../../intern/memutil @@ -73,7 +74,7 @@ set(SRC GPG_System.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index b85d4b40ca8..d7a63c28da3 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -36,8 +36,9 @@ # include <windows.h> #endif -#include "GL/glew.h" +#include "glew-mx.h" #include "GPU_extensions.h" +#include "GPU_init_exit.h" #include "GPG_Application.h" #include "BL_BlenderDataConversion.h" @@ -545,7 +546,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) { if (!m_engineInitialized) { - GPU_extensions_init(); + GPU_init(); bgl::InitExtensions(true); // get and set the preferences @@ -867,7 +868,7 @@ void GPG_Application::exitEngine() m_canvas = 0; } - GPU_extensions_exit(); + GPU_exit(); #ifdef WITH_PYTHON // Call this after we're sure nothing needs Python anymore (e.g., destructors) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp index 35c7c62a67d..556f85804ea 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp @@ -113,12 +113,12 @@ void GPG_Canvas::SetSwapInterval(int interval) m_window->setSwapInterval(interval); } -int GPG_Canvas::GetSwapInterval() +bool GPG_Canvas::GetSwapInterval(int& intervalOut) { if (m_window) - return m_window->getSwapInterval(); + return (bool)m_window->getSwapInterval(intervalOut); - return 0; + return false; } void GPG_Canvas::ResizeWindow(int width, int height) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h index 6e1f86cac0e..337c2cedf55 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h @@ -56,7 +56,7 @@ public: virtual void SetMouseState(RAS_MouseState mousestate); virtual void SwapBuffers(); virtual void SetSwapInterval(int interval); - virtual int GetSwapInterval(); + virtual bool GetSwapInterval(int& intervalOut); virtual int GetMouseX(int x) { return x; } virtual int GetMouseY(int y) { return y; } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index b6456b105c8..3bb5f17841d 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -79,8 +79,6 @@ extern "C" #include "IMB_imbuf.h" #include "IMB_moviecache.h" - int GHOST_HACK_getFirstFile(char buf[]); - // For BLF #include "BLF_api.h" #include "BLF_translation.h" @@ -294,12 +292,6 @@ static void get_filename(int argc, char **argv, char *filename) if (BLI_exists(argv[argc-1])) { BLI_strncpy(filename, argv[argc-1], FILE_MAX); } - if (::strncmp(argv[argc-1], "-psn_", 5)==0) { - static char firstfilebuf[512]; - if (GHOST_HACK_getFirstFile(firstfilebuf)) { - BLI_strncpy(filename, firstfilebuf, FILE_MAX); - } - } } srclen -= ::strlen("MacOS/blenderplayer"); @@ -811,14 +803,6 @@ int main(int argc, char** argv) if (scr_saver_mode != SCREEN_SAVER_MODE_CONFIGURATION) #endif { - - if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) { - GPU_set_mipmap(0); - } - - GPU_set_anisotropic(U.anisotropic_filter); - GPU_set_gpu_mipmapping(U.use_gpu_mipmap); - // Create the system if (GHOST_ISystem::createSystem() == GHOST_kSuccess) { GHOST_ISystem* system = GHOST_ISystem::getSystem(); @@ -1041,6 +1025,13 @@ int main(int argc, char** argv) else app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight, stereoWindow, stereomode, aasamples); + + if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) { + GPU_set_mipmap(0); + } + + GPU_set_anisotropic(U.anisotropic_filter); + GPU_set_gpu_mipmapping(U.use_gpu_mipmap); } } } diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 3e8ab3d0dd7..d4c31889a5e 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -68,15 +68,14 @@ incs = [ '#source/blender/misc', '#source/blender/blenloader', '#source/blender/gpu', - '#extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', ] incs.append(env['BF_PTHREADS_INC']) incs.append(env['BF_BOOST_INC']) -defs = [ - 'GLEW_STATIC', - ] +defs = env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: incs += Split(env['BF_PYTHON_INC']) |