Move OpenGL texture upload mapping
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "texture.h"
|
||||
#include "util.h"
|
||||
#include "app.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
std::map<uint16_t, Texture2D> TextureManager::m_textures;
|
||||
std::array<int, 6> TextureCube::m_faces_map {
|
||||
@@ -176,9 +179,8 @@ bool Texture2D::create(int width, int height, GLint internal_format, GLint forma
|
||||
glGenTextures(1, &m_tex);
|
||||
//LOG("TEX create %d", m_tex);
|
||||
bind();
|
||||
auto ifmt = GL_UNSIGNED_BYTE;
|
||||
if (internal_format == GL_RGBA32F) ifmt = GL_FLOAT;
|
||||
if (internal_format == GL_RGBA16F) ifmt = GL_HALF_FLOAT;
|
||||
const auto ifmt = static_cast<GLenum>(
|
||||
pp::renderer::gl::texture_upload_type_for_internal_format(static_cast<std::uint32_t>(internal_format)));
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, ifmt, data);
|
||||
unbind();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user