OpenGL: Implement VAOs

This commit is contained in:
Lynix
2020-05-11 14:10:36 +02:00
parent 332278dded
commit fe5b70ae1c
8 changed files with 422 additions and 33 deletions

View File

@@ -0,0 +1,51 @@
// 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 <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <string>
namespace Nz::GL
{
template<typename C, GLenum ObjectType, typename... CreateArgs>
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<const Context> m_context;
MovableValue<GLuint> m_objectId;
};
}
#include <Nazara/OpenGLRenderer/Wrapper/ContextObject.inl>
#endif