How to detect maximum texture resolution on iPhone?

匿名 (未验证) 提交于 2019-12-03 02:19:01

问题:

I'm making an universal openGL based app that should work on ipod/iphone 2G/3G/3GS/4 and iPad.

To deliver the best possible graphics I need to switch between different texture resolutions based on what device is running it.

For example, iPhone 2G needs textures that is no larger than 1024x1024, while iPhone 3GS can handle larger textures.

So, on iPhone 3GS I want to load a texture atlas that's 2048x2048, while iPhone 2G will get the downscaled 1024x1024 texture atlas.

Is there a simple and safe way to detect the maximum texture resolution available to openGL on any said device?

回答1:

Yes, use glGetIntegerv like:

int maxTextureSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); 

Then you can use at most a maxTextureSize x maxTextureSize texture.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!