My question may not be very correct, but let me describe it in details. I use cocos2d-x (renders using opengl-es 2) game engine to show images on Android device. In some cases when image dimensions are very large the images are not being displayed. They just get skipped. But I see that the size of the image is smaller then the size of my device VRAM. Checked with this method with /dev/graphics/fb0
: How to measure VRAM consumption on Android?. So my file size is 532,042 bytes
, its dimension are 2160x1224
and my vram size is 3072000 bytes
. Why this image is not being handled by the device? And what is the criteria and limit? How can I check the limit for a device?
Why this image is not being handled by the device?
Because there's a difference between how much can be placed in RAM and the maximum size of a single chunk of data that can be processed. There's a certain limit to each GPU on the maximum size of an image it can handle. The size of the RAM just tells you, how many images will fit there. However OpenGL's memory model is purely abstract and the amount of VRAM doesn't tell you anything about how many textures you can load. Data can and will be swapped in and out of VRAM whenever required. The actual limit is in fact the amount of memory available to your system as a whole.
I can't tell you for Cocos2D but in OpenGL and OpenGL-ES you can query the maximum sizes supported for various texture types using glGetInteger
OpenGL-ES glGetInteger reference. In your case you're probably interested in the value GL_MAX_TEXTURE_SIZE
. Note that for texture targets other than GL_TEXTURE_1D and GL_TEXTURE_2D different values must be queried.