Is it slower to draw small sprites with large textures on iPhone?
I'm looking for ways to optimize opengl rendering in my iPhone game. I wonder if anyone has experience with the impact of texture size when it comes to rendering a sprite?
For example, would a sprite rendered as a 100x100 pixels big rectangle render slower if it's texture source is 512x512 pixels rather than say 32x3开发者_JAVA技巧2 pixels?
Yes, smaller texture sizes are faster than big ones, but for sprites using multiple small textures will actually be slower. You want to reduce the amount of texture binds, so packing all your sprites into one big texture and drawing them using appropriate uv's would be most efficient.
It depends some on which minification (because 512 > 100) and magnification (because 32 < 100) filters you are using.
I'd guess that rendering 100x100 pixels from either a 512x512 or a 256x256 texture is just as fast. Especially if the textures are mipmapped (because it will likely use a mip level of the same size in each case).
精彩评论