如何检测 iPhone 上的最大纹理分辨率? [英] How to detect maximum texture resolution on iPhone?

查看:31
本文介绍了如何检测 iPhone 上的最大纹理分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个通用的基于 openGL 的应用程序,它应该可以在 ipod/iphone 2G/3G/3GS/4 和 iPad 上运行.

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.

例如,iPhone 2G 需要不大于 1024x1024 的纹理,而 iPhone 3GS 可以处理更大的纹理.

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

所以,在 iPhone 3GS 上,我想加载一个 2048x2048 的纹理图集,而 iPhone 2G 将获得缩小后的 1024x1024 纹理图集.

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

是否有一种简单且安全的方法来检测任何上述设备上可用于 openGL 的最大纹理分辨率?

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

推荐答案

是的,使用 glGetIntegerv like:

Yes, use glGetIntegerv like:

int maxTextureSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);

那么你最多可以使用一个 maxTextureSize x maxTextureSize 纹理.

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

这篇关于如何检测 iPhone 上的最大纹理分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆