Reputation: 6188
I recently tested one of my games on several Android devices. During that, I came across a weird encounter with Galaxy S2. When I launched the game, the whole game was working fine except the background. The background of the game was appearing black instead of the intended texture. While searching through the internet, I came across this forum and realized that this was a bad texture problem on Galaxy S2 because the background image for the game was contained in a separate and very large sprite sheet (4096) while the rest of the actors for the game were contained in a smaller one. From this, I conceived that this was something related to GL_MAX_TEXTURE_SIZE.
Now my question is: Is it possible for a device with a large display such as the Google Nexus 10 (with a width of 2560 ) to have a GL_MAX_TEXTURE_SIZE of perhaps 2048?
And moreover, what is the most common GL_MAX_TEXTURE_SIZE on Android devices and how to cater with such kind of problems if you also want your application to serve devices with very large resolutions?
Upvotes: 3
Views: 1611
Reputation: 10125
Yes it is possible unfortunately.
Mobile devices can vary between each other. OpenGL ES 2.0 spec says that minimum value of GL_MAX_TEXTURE_SIZE is only 64! So it is good habit to check hardware caps in your game. Vendors need to support only minimum of spec and the rest is their choice.
see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml for some info about opengl ES 2.0 minimum caps.
here: http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/DeterminingOpenGLESCapabilities/DeterminingOpenGLESCapabilities.html there is info that:
PowerVR MBX graphics hardware support textures up to 1024 x 1024 in size, while the PowerVR SGX software supports textures up to 2048 x 2048; both sizes greatly exceed 64 x 64, which is the minimum size required in the OpenGL ES specification. If your application’s needs exceeds the minimum capabilities required by the OpenGL ES specification, it should query the implementation to check the actual capabilities of the hardware and fail gracefully; you may load a smaller texture or choose a different rendering strategy.
This is from iPhone... but the same hardware can be found on Android devices as well.
On OpenGL ES 3.0 minimum value of GL_MAX_TEXTURE_SIZE is 2048 http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGet.xml
what to do then? OpenGL gives a decent and unified software layer that can be used to make your apps. But still there are some differences between platforms and hardware. Usually in the game engine we check for given capability and then do some "fall-back" to be sure it is working even on minimal requirements. There is no single answer to you question. It depends on the problem.
for texture size I think you can cut your large texture into some smaller pieces and then display it using several rectangles/quads
Upvotes: 3