// 存在第二次拿拿不到的情况,所以把拿到的数据用一个static变量保存下来 public static int getTextureSize() { if (textureSize > 0) { return textureSize; } int[] params = new int[1]; GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, params, 0); textureSize = params[0]; return textureSize; }
@Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub if (mMaxSize == 0) { int[] maxTextureSize = new int[1]; GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0); mMaxSize = maxTextureSize[0]; if (mListener != null) { mListener.OnMaxSizeChange(); } } super.onDraw(canvas); }
public static int getSupportedMaxPictureSize() { int[] array = new int[1]; GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, array, 0); try { if (array[0] == 0) { GLES11.glGetIntegerv(GLES11.GL_MAX_TEXTURE_SIZE, array, 0); if (array[0] == 0) { GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, array, 0); if (array[0] == 0) { GLES30.glGetIntegerv(GLES30.GL_MAX_TEXTURE_SIZE, array, 0); } } } } catch (NoClassDefFoundError e) { // Ignore the exception } return array[0] != 0 ? array[0] : 2048; }
private int getMaxTextureSize() { // The OpenGL texture size is the maximum size that can be drawn in an ImageView int[] maxSize = new int[1]; GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, maxSize, 0); return maxSize[0]; }