// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - OpenGL Renderer" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_OPENGLRENDERER_GLCONTEXTOBJECT_HPP #define NAZARA_OPENGLRENDERER_GLCONTEXTOBJECT_HPP #include #include #include #include namespace Nz::GL { template class ContextObject { public: ContextObject() = default; ContextObject(const ContextObject&) = delete; ContextObject(ContextObject&& object) noexcept = default; ~ContextObject(); bool Create(const Context& context, CreateArgs... args); void Destroy(); bool IsValid() const; const Context* GetContext() const; GLuint GetObjectId() const; void SetDebugName(const std::string_view& name); ContextObject& operator=(const ContextObject&) = delete; ContextObject& operator=(ContextObject&& object) noexcept = default; static constexpr GLuint InvalidObject = 0; protected: void EnsureContext(); MovablePtr m_context; MovableValue m_objectId; }; } #include #endif