CJ Scholten
CJ Scholten

Reputation: 713

Get OpenGL max texture size

I'm developing an Android app that's going to work with bitmaps extensively and I'm looking for a reliable way to get the maximum texture size for OpenGL on different devices.
I know the minimum size = 2048x2048, but that's not good enough since there are already tablets out there with much higher resolutions (2560x1600 for example)
So is there a reliable way to get this information?

So far I've tried:

I'm working with minimum-sdk = 15 (ICS) and I'm testing it on a Asus Transformer TF700t Infinity

Does anyone know another way to get it? Or will I have to compile a list of known GPUs with their max canvas size?

Upvotes: 7

Views: 9921

Answers (2)

tinaJohnny
tinaJohnny

Reputation: 173

try using this code

int[] maxTextureSize = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);

maxTextureSize stores the size limit for decoded image such as 4096x4096, 8192x8192 . Remember to run this piece of code in the MainThread or you will get Zero.

Upvotes: 7

Francesco Donzello
Francesco Donzello

Reputation: 773

This will give you the maximum height allowed.

Canvas canvas = new Canvas();
canvas.getMaximumBitmapHeight() / 8

Upvotes: 0

Related Questions