开发者

glgConvertTo_32 on the iPhone

开发者 https://www.devze.com 2023-03-30 07:34 出处:网络
I ran my app through Instruments today and noticed that an excessively high amount of time was being spent in the \"glgConvertTo_32\" function. I read elsewhere that this is because Apple uses \"GL_BG

I ran my app through Instruments today and noticed that an excessively high amount of time was being spent in the "glgConvertTo_32" function. I read elsewhere that this is because Apple uses "GL_BGRA and GL_UNSIGNED_INT_8_8_8_8_REV" for it's texture format, and my code uses GL_RGBA.

I'm using glTexture2D as follows:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData);

Neither GL_BGRA nor GL_UNSIGNED_INT_8_8_8_8_REV are available in the GL headers for iPhone, however. Is there another reason for the high volume of calls to that function, or is there possibly a different texture format I should be using?

EDIT:开发者_StackOverflow社区 I should mention that I'm using OpenGL ES 2.0.


I don't know if my problem/solution is really related to yours. But your unanswered question was the first result google found while investigating my problem.

Although I use OpenGL ES 1.1 and don't use Textures I also noticed that my app spends about 23% of time in the function glgConvertTo_32().

After changing the value of kEAGLDrawablePropertyColorFormat from kEAGLColorFormatRGBA8 to kEAGLColorFormatRGB565 in eaglLayer.drawableProperties the function glgConvertTo_32() is not called anymore. The app feels faster and I don't see a visual difference.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号