// Copyright (C) 2023 Jérôme "Lynix" 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_DEVICEOBJECT_HPP #define NAZARA_OPENGLRENDERER_WRAPPER_DEVICEOBJECT_HPP #include #include #include #include #include namespace Nz::GL { template class DeviceObject { public: DeviceObject() = default; DeviceObject(OpenGLDevice& device, CreateArgs... args); DeviceObject(const DeviceObject&) = delete; DeviceObject(DeviceObject&& object) noexcept = default; ~DeviceObject(); bool Create(OpenGLDevice& device, CreateArgs... args); void Destroy(); const Context& EnsureDeviceContext() const; bool IsValid() const; OpenGLDevice* GetDevice() const; GLuint GetObjectId() const; void SetDebugName(const std::string_view& name); DeviceObject& operator=(const DeviceObject&) = delete; DeviceObject& operator=(DeviceObject&& object) noexcept = default; static constexpr GLuint InvalidObject = 0; protected: MovablePtr m_device; MovableValue m_objectId; }; } #include #endif // NAZARA_OPENGLRENDERER_WRAPPER_DEVICEOBJECT_HPP