// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com) // 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_WRAPPER_CONTEXTOBJECT_HPP #define NAZARA_OPENGLRENDERER_WRAPPER_CONTEXTOBJECT_HPP #include #include #include #include namespace Nz::GL { template class ContextObject { public: ContextObject() = default; ContextObject(const Context& context, CreateArgs... args); ContextObject(const ContextObject&) = delete; ContextObject(ContextObject&& object) noexcept = default; ~ContextObject(); bool Create(const Context& context, CreateArgs... args); void Destroy(); const Context& EnsureContext() const; bool IsValid() const; const Context* GetContext() const; GLuint GetObjectId() const; void SetDebugName(std::string_view name); ContextObject& operator=(const ContextObject&) = delete; ContextObject& operator=(ContextObject&& object) noexcept = default; static constexpr GLuint InvalidObject = 0; protected: MovableLiteral m_objectId; MovablePtr m_context; }; } #include #endif // NAZARA_OPENGLRENDERER_WRAPPER_CONTEXTOBJECT_HPP