OpenGLRenderer: Improve OpenGL wrapper

This commit is contained in:
Jérôme Leclercq
2021-09-21 16:34:34 +02:00
parent 250044b47a
commit 78358337f3
12 changed files with 57 additions and 18 deletions

View File

@@ -20,6 +20,9 @@ namespace Nz
if (!format)
throw std::runtime_error("unsupported texture format");
const GL::Context& context = m_texture.EnsureDeviceContext();
context.ClearErrorStack();
switch (params.type)
{
case ImageType::E1D:
@@ -46,6 +49,9 @@ namespace Nz
break;
}
if (!context.DidLastCallSucceed())
throw std::runtime_error("failed to create texture");
m_texture.SetParameteri(GL_TEXTURE_MAX_LEVEL, m_params.mipmapLevel);
m_texture.SetParameteri(GL_TEXTURE_SWIZZLE_R, format->swizzleR);
m_texture.SetParameteri(GL_TEXTURE_SWIZZLE_G, format->swizzleG);