Developers Manual > Cocos2d-x > Modules > 2D Graphics > Max size of textures in cocos2d-x depends on each platform

Max size of textures in cocos2d-x depends on each platform

In theory, cocos2d-x could show textures in any size, but actually the maxsize of the textures is restricted by the hardware and the system.
Here I provide a texture-size restriction table on different platforms’ emulators.

platform maxsize in pixelsr
win32 2048 * 2048
android 4096 * 4096
iPhone3 1024 * 1024
iPhone3GS 2048 * 2048
iPhone4 2048 * 2048

On the real machines, they aslo have different restrictions, here are some test results: G3 (Hero) 1024 * 1024, iPhone4 2048 * 2048.

So, for the developers, if you want to cross platforms and run your games smoothly, you should keep your texture size less than 1024 * 1024, that is the lowest restriction for most machines.

Code to get max size of texture that the device support: (might not work in simulator)

GLint m_maxTextureSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);

Copyright © 2010 - 2014 Cocos2d-x.org Support Email: support@cocos.org