我的图片不是2的N次方 不过我这样处理
GLfloat nWidthPowerOfTwo = next_p2(width);
GLfloat nHeightPowerOfTwo = next_p2(height); if(width == nWidthPowerOfTwo && height == nHeightPowerOfTwo)
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nWidthPowerOfTwo, nHeightPowerOfTwo, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
}
else
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nWidthPowerOfTwo, nHeightPowerOfTwo, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
LOGI("the bitmap's width or height is not sizeTofit");
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, nHeightPowerOfTwo-height, width, height, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
}openGL es 1.1版本的
GLfloat nWidthPowerOfTwo = next_p2(width);
GLfloat nHeightPowerOfTwo = next_p2(height); if(width == nWidthPowerOfTwo && height == nHeightPowerOfTwo)
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nWidthPowerOfTwo, nHeightPowerOfTwo, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
}
else
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nWidthPowerOfTwo, nHeightPowerOfTwo, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
LOGI("the bitmap's width or height is not sizeTofit");
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, nHeightPowerOfTwo-height, width, height, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
}openGL es 1.1版本的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货