views:

1226

answers:

2

Hi,

I'm trying to convert window coordinates to object coordinates. There's a gluUnProject in GLU class, which requires current modelview, projection matrices and viewport.

My question is how to get those matrices? I tried gl.glGetIntegerv (GL11.GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES, model, 0); and ((GL11) gl).glGetFloatv(GL11.GL_MODELVIEW_MATRIX, modelf, 0); but the first one returns an array of zeros, and the other one just shows an "method not implemented" error.

Is gluUnProject the correct method for this purpose (i.e. window coordinates --> object coordinates) ?

+1  A: 

you cannot get the matrix, since Android provides GLES 1.0, and not GLES 1.1 at this point, and therefor doesn't support all the various glGet* functions of 1.1.

Reflog
Thanks, I ended up with tracking the matrix on my own.
focuser
A: 

You can find MatrixGrabber in the samples that are provided with the SDK. You can use MatrixGrabber (which internally keeps track of the matrices) to get the modelview and projection matrices.

CiscoIPPhone