OpenGL: Better handling for activation/desactivation

This commit is contained in:
Lynix
2020-04-19 15:28:59 +02:00
parent d62e99091f
commit f63d045676
4 changed files with 76 additions and 54 deletions

View File

@@ -56,17 +56,24 @@ namespace Nz::GL
NAZARA_OPENGLRENDERER_FOREACH_GLES_FUNC(NAZARA_OPENGLRENDERER_FUNC)
#undef NAZARA_OPENGLRENDERER_FUNC
static const Context* GetCurrentContext();
static bool SetCurrentContext(const Context* context);
protected:
virtual bool Activate() const = 0;
virtual void Desactivate() const = 0;
virtual const Loader& GetLoader() = 0;
virtual bool ImplementFallback(const std::string_view& function);
std::unordered_set<std::string> m_supportedExtensions;
static void NotifyContextDestruction(Context* context);
ContextParams m_params;
private:
void GL_APIENTRY HandleDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message) const;
std::unordered_set<std::string> m_supportedExtensions;
};
}

View File

@@ -31,8 +31,6 @@ namespace Nz::GL
WGLContext(WGLContext&&) = delete;
~WGLContext();
bool Activate() override;
bool Create(const WGLContext* baseContext, const ContextParams& params, const WGLContext* shareContext = nullptr);
bool Create(const WGLContext* baseContext, const ContextParams& params, WindowHandle window, const WGLContext* shareContext = nullptr);
void Destroy();
@@ -50,7 +48,8 @@ namespace Nz::GL
bool CreateInternal(const WGLContext* baseContext, const ContextParams& params, const WGLContext* shareContext = nullptr);
bool ImplementFallback(const std::string_view& function) override;
void Desactivate();
bool Activate() const override;
void Desactivate() const override;
const Loader& GetLoader() override;
bool LoadWGLExt();
bool SetPixelFormat();