私のゲームでは、プレイヤーが触れている場所を見つける必要があります。MotionEvent.getX() と MotionEvent.getY() はウィンドウ座標を返します。そこで、この関数を作成して、ウィンドウ座標を OpenGL 座標に変換することをテストしました。
public void ConvertCoordinates(GL10 gl) {
float location[] = new float[4];
final MatrixGrabber mg = new MatrixGrabber(); //From the SpriteText demo in the samples.
mg.getCurrentProjection(gl);
mg.getCurrentModelView(gl);
int viewport[] = {0,0,WinWidth,WinHeight};
GLU.gluUnProject((float) WinWidth/2, (float) WinHeight/2, (float) 0, mg.mModelView, 0, mg.mProjection, 0, viewport, 0, location,0);
Log.d("Location",location[1]+", "+location[2]+", "+location[3]+"");
}
X と y は、ほぼ -33 からほぼ +33 まで振動しました。Z は通常 10 です。MatrixGrabber を間違って使用したのでしょうか。