OpenGLRenderer: Fix textures

This commit is contained in:
Jérôme Leclercq
2020-08-09 18:38:58 +02:00
parent 0da2ee6c99
commit ac7b523bc7
5 changed files with 60 additions and 51 deletions

View File

@@ -10,6 +10,19 @@
namespace Nz
{
inline std::optional<GLTextureFormat> DescribeTextureFormat(PixelFormat pixelFormat)
{
switch (pixelFormat)
{
case PixelFormat_A8: return GLTextureFormat { GL_R8, GL_RED, GL_UNSIGNED_BYTE, GL_ZERO, GL_ZERO, GL_ZERO, GL_RED };
case PixelFormat_RGB8: return GLTextureFormat { GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, GL_RED, GL_GREEN, GL_BLUE, GL_ZERO };
case PixelFormat_RGBA8: return GLTextureFormat { GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
}
NazaraError("Unhandled PixelFormat 0x" + String::Number(UnderlyingCast(pixelFormat), 16));
return {};
}
inline GLenum ToOpenGL(BlendFunc blendFunc)
{
switch (blendFunc)