OpenGL: Implement textures

This commit is contained in:
Lynix
2020-04-19 15:33:56 +02:00
parent 349e915e10
commit b4b15f826d
12 changed files with 227 additions and 298 deletions

View File

@@ -43,6 +43,16 @@ namespace Nz::GL
KHR
};
enum class TextureTarget
{
Cubemap,
Target2D,
Target2D_Array,
Target3D,
Max = Target3D
};
struct ContextParams
{
ContextType type = ContextType::OpenGL_ES;
@@ -63,6 +73,7 @@ namespace Nz::GL
inline Context(const OpenGLDevice* device);
virtual ~Context();
void BindTexture(TextureTarget target, GLuint texture) const;
virtual void EnableVerticalSync(bool enabled) = 0;
@@ -75,6 +86,8 @@ namespace Nz::GL
bool Initialize(const ContextParams& params);
inline void NotifyTextureDestruction(GLuint texture) const;
virtual void SwapBuffers() = 0;
#define NAZARA_OPENGLRENDERER_FUNC(name, sig) sig name = nullptr;
@@ -98,9 +111,15 @@ namespace Nz::GL
private:
void GL_APIENTRY HandleDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message) const;
struct State
{
std::array<GLuint, UnderlyingCast(TextureTarget::Max) + 1> boundTextures;
};
std::array<ExtensionStatus, UnderlyingCast(Extension::Max) + 1> m_extensionStatus;
std::unordered_set<std::string> m_supportedExtensions;
const OpenGLDevice* m_device;
mutable State m_state;
};
}