OpenGLRenderer: Use generic DeviceObject

This commit is contained in:
Lynix
2020-04-26 16:26:08 +02:00
parent b4b15f826d
commit 1c23949608
6 changed files with 137 additions and 215 deletions

View File

@@ -10,19 +10,19 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
namespace Nz::GL
{
class Texture
class Texture : public DeviceObject<Texture, GL_TEXTURE>
{
friend DeviceObject;
public:
Texture() = default;
Texture(const Texture&) = delete;
Texture(Texture&&) noexcept = default;
inline ~Texture();
inline bool Create(OpenGLDevice& device);
inline void Destroy();
~Texture() = default;
inline void TexImage2D(GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border);
inline void TexImage2D(GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* data);
@@ -32,10 +32,8 @@ namespace Nz::GL
Texture& operator=(Texture&&) noexcept = default;
private:
const Context& EnsureDeviceContext();
MovablePtr<OpenGLDevice> m_device;
MovableValue<GLuint> m_texture;
static inline GLuint CreateHelper(OpenGLDevice& device, const Context& context);
static inline void DestroyHelper(OpenGLDevice& device, const Context& context, GLuint objectId);
};
}