diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-16 11:15:15 +0000 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-16 11:15:15 +0000 |
commit | 52ffc461e5a1a4e0e1230ac96ef6d77a984ee059 (patch) | |
tree | ac6d889185b197dd1ddfbf76445de663fb490969 /src/main.cpp | |
parent | a68bb92400c707c71e0ec42c43a3f9cf3b863160 (diff) | |
download | vr-video-player-52ffc461e5a1a4e0e1230ac96ef6d77a984ee059.tar.gz vr-video-player-52ffc461e5a1a4e0e1230ac96ef6d77a984ee059.tar.bz2 vr-video-player-52ffc461e5a1a4e0e1230ac96ef6d77a984ee059.zip |
Fix window resize memory leak (nvidia is not cleaning up on glDeleteTextures)
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 22ad039..5e4cd74 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -568,6 +568,10 @@ CMainApplication::CMainApplication( int argc, char *argv[] ) cursor_scale_uniform[0] = 0.0f; cursor_scale_uniform[1] = 0.0f; + +#ifdef DEBUG + m_bDebugOpenGL = true; +#endif }; @@ -808,9 +812,9 @@ bool CMainApplication::BInitGL() { if( m_bDebugOpenGL ) { + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback( (GLDEBUGPROC)DebugCallback, nullptr); glDebugMessageControl( GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE ); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } if( !CreateAllShaders() ) @@ -845,9 +849,8 @@ bool CMainApplication::BInitGL() glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); float fLargest = 0.0f; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &fLargest); @@ -985,6 +988,7 @@ bool CMainApplication::HandleInput() { SDL_Event sdlEvent; bool bRet = false; + bool zoom_resize = false; while ( SDL_PollEvent( &sdlEvent ) != 0 ) { @@ -1005,7 +1009,7 @@ bool CMainApplication::HandleInput() if( sdlEvent.key.keysym.sym == SDLK_q ) { zoom -= 0.01f; - window_resized = true; + zoom_resize = true; std::stringstream strstr; strstr << "/tmp/vr-video-player_" << src_window_id; @@ -1015,7 +1019,7 @@ bool CMainApplication::HandleInput() if( sdlEvent.key.keysym.sym == SDLK_e ) { zoom += 0.01f; - window_resized = true; + zoom_resize = true; std::stringstream strstr; strstr << "/tmp/vr-video-player_" << src_window_id; @@ -1055,6 +1059,9 @@ bool CMainApplication::HandleInput() SetupScene(); } + if(!window_resized && zoom_resize) + SetupScene(); + // Process SteamVR events vr::VREvent_t event; while( m_pHMD->PollNextEvent( &event, sizeof( event ) ) ) |