fix mixer on iOS, work with RGBA16F buffers on iOS instead of fallback to RGBA8

This commit is contained in:
2018-08-05 16:27:26 +02:00
parent 2137de66ff
commit 0fb6658373
6 changed files with 27 additions and 15 deletions

View File

@@ -46,8 +46,10 @@ bool Texture2D::create(int width, int height, GLint internal_format, GLint forma
glGenTextures(1, &m_tex);
//LOG("TEX create %d", m_tex);
bind();
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format,
internal_format == GL_RGBA32F ? GL_FLOAT : GL_UNSIGNED_BYTE, data);
auto ifmt = GL_UNSIGNED_BYTE;
if (internal_format == GL_RGBA32F) ifmt = GL_FLOAT;
if (internal_format == GL_RGBA16F) ifmt = GL_HALF_FLOAT;
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, ifmt, data);
unbind();
return true;
}