Android opengl debug callback, Android device properties, fix texture internal format
This commit is contained in:
@@ -14,9 +14,9 @@ bool TextureManager::load(const char* path)
|
||||
return true;
|
||||
}
|
||||
|
||||
void TextureManager::assign(uint16_t id, GLuint tex, int w/* = -1*/, int h/* = -1*/, GLuint format/* = GL_RGBA*/)
|
||||
void TextureManager::assign(uint16_t id, GLuint tex, int w/* = -1*/, int h/* = -1*/, GLuint internal_format/* = GL_RGBA8*/, GLuint format/* = GL_RGBA*/)
|
||||
{
|
||||
m_textures[id].assign(tex, w, h, format);
|
||||
m_textures[id].assign(tex, w, h, internal_format, format);
|
||||
}
|
||||
|
||||
Texture2D& TextureManager::get(uint16_t id)
|
||||
@@ -24,29 +24,32 @@ Texture2D& TextureManager::get(uint16_t id)
|
||||
return m_textures[id];
|
||||
}
|
||||
|
||||
bool Texture2D::create(int width, int height, GLint format, const uint8_t* data)
|
||||
bool Texture2D::create(int width, int height, GLint internal_format, GLint format, const uint8_t* data)
|
||||
{
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_format = format;
|
||||
m_iformat = internal_format;
|
||||
glGenTextures(1, &m_tex);
|
||||
bind();
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, format, GL_UNSIGNED_BYTE, data);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, data);
|
||||
unbind();
|
||||
return true;
|
||||
}
|
||||
bool Texture2D::create(const ui::Image& img)
|
||||
{
|
||||
static GLint formats[] = { GL_RED, GL_RG, GL_RGB, GL_RGBA };
|
||||
return create(img.width, img.height, formats[img.comp - 1], img.data());
|
||||
static GLint iformats[] = { GL_R8, GL_RG8, GL_RGB8, GL_RGBA8 };
|
||||
return create(img.width, img.height, iformats[img.comp - 1], formats[img.comp - 1], img.data());
|
||||
}
|
||||
|
||||
void Texture2D::assign(GLuint tex, int w/* = -1*/, int h/* = -1*/, GLuint format/* = GL_RGBA*/)
|
||||
void Texture2D::assign(GLuint tex, int w/* = -1*/, int h/* = -1*/, GLuint internal_format/* = GL_RGBA8*/, GLuint format/* = GL_RGBA*/)
|
||||
{
|
||||
m_tex = tex;
|
||||
m_width = w;
|
||||
m_height = h;
|
||||
m_format = format;
|
||||
m_iformat = internal_format;
|
||||
}
|
||||
|
||||
bool Texture2D::load(std::string filename)
|
||||
|
||||
Reference in New Issue
Block a user