3
votes

I'm a Unity3D developer working on mobile games. Recently we ran into an issue where all of our textures were being rendered as black square. After some research we found out that it had to do with the devices support of maximum texture sizes. The devices in question (iPhone 4 and older android phones) only supported a maximum texture size of 2048 x 2048, while the newer devices had a maximum texture size support of 4096 x 4096. To resolve the problem we unpacked our sprite map into several smaller 2048 x 2048 texture maps.

Two Questions:

1) What determines the maximum supported texture size of a particular device? Is it the graphics card, some kind of hardware limitation? Or is it the supported version for OpenGL ES that determines this?

2) Is there an easy way to pro-grammatically find out the maximum texture size the device is? If so what API or SDK would you be using to find the information

1
This post is relevant to your question: stackoverflow.com/a/19572916/3256930.user3256930

1 Answers

4
votes

1) It's determined by the device hardware, specifically the graphics chip (GPU).

2) Yes. It's part of an OpenGL property reported by the graphics card. Try this code snippet:

int size;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);

As long as you're only considering iOS devices it's pretty easy: 4096x4096 textures are supported by iPhone 4S and newer and iPad 2 and newer. Older devices support only 2048x2048.

iPad 2 is a special case, if the installed iOS version is 5.0 or older it will only be able to use 2048x2048.