I’d like to accomplish the following in Android using API Level 7:
glGet(GL_VIEWPORT, someBuffer)
Documentation for OpenGL ES 1.1 shows this as part of the C API.
I’ve tried using the following code:
int[] results = new int[4];
gl.glGetIntegerv(GL10.GL_MAX_VIEWPORT_DIMS, results, 0);
for (int i = 0; i < results.length; i++) {
Log.e(TAG, "results[" + i + "]: " + results[i]);
}
I get output in various phases of the surface like so:
onSurfaceCreated called
results[0]: 4096
results[1]: 4096
results[2]: 0
results[3]: 0
onSurfaceChanged called with height: 800 and width: 480
//NOTE: gl.glViewport(0, 0, width, height); is called here
results[0]: 4096
results[1]: 4096
results[2]: 0
results[3]: 0
onDrawFrame called
results[0]: 4096
results[1]: 4096
results[2]: 0
results[3]: 0
How would one do this using Android’s kronos GLES?
I discovered that Android protects you from yourself.
onSurfaceChangedis called before anyonDrawFramecalls. It’s on us to capture and persist any of this data.