- if (handle) {
- SDL_GL_DeleteContext(handle);
- }
-}
-
-
-GLContext::GLContext(GLContext &&other)
-: handle(other.handle) {
- other.handle = nullptr;
-}
-
-GLContext &GLContext::operator =(GLContext &&other) {
- std::swap(handle, other.handle);
- return *this;
-}
-
-void GLContext::EnableVSync() {
- if (SDL_GL_SetSwapInterval(1) != 0) {
- sdl_error("SDL_GL_SetSwapInterval");
- }
-}
-
-void GLContext::EnableDepthTest() noexcept {
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS);
-}
-
-void GLContext::EnableBackfaceCulling() noexcept {
- glEnable(GL_CULL_FACE);
-}
-
-void GLContext::EnableAlphaBlending() noexcept {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-}
-
-void GLContext::EnableInvertBlending() noexcept {
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
-}
-
-void GLContext::DisableBlending() noexcept {
- glDisable(GL_BLEND);
-}
-
-void GLContext::Clear() noexcept {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-}
-
-void GLContext::ClearDepthBuffer() noexcept {
- glClear(GL_DEPTH_BUFFER_BIT);