1 /* 2 Copyright (C) 2010-2014 Kristian Duske 3 4 This file is part of TrenchBroom. 5 6 TrenchBroom is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 TrenchBroom is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef TrenchBroom_GLContextManager 21 #define TrenchBroom_GLContextManager 22 23 #include "View/GLContext.h" 24 25 class wxGLCanvas; 26 27 namespace TrenchBroom { 28 namespace Renderer { 29 class FontManager; 30 class ShaderManager; 31 class Vbo; 32 } 33 34 namespace View { 35 class GLContextManager { 36 private: 37 GLContext::Ptr m_mainContext; 38 bool m_initialized; 39 40 Renderer::Vbo* m_vertexVbo; 41 Renderer::Vbo* m_indexVbo; 42 Renderer::FontManager* m_fontManager; 43 Renderer::ShaderManager* m_shaderManager; 44 public: 45 GLContextManager(); 46 ~GLContextManager(); 47 48 GLContext::Ptr createContext(wxGLCanvas* canvas); 49 wxGLContext* mainContext() const; 50 51 bool initialized() const; 52 bool initialize(); 53 54 Renderer::Vbo& vertexVbo(); 55 Renderer::Vbo& indexVbo(); 56 Renderer::FontManager& fontManager(); 57 Renderer::ShaderManager& shaderManager(); 58 private: 59 GLContextManager(const GLContextManager& other); 60 GLContextManager& operator=(const GLContextManager& other); 61 }; 62 } 63 } 64 65 #endif /* defined(TrenchBroom_GLContextManager) */ 66