¡@

Home 

2014/10/16 ¤W¤È 08:14:19

android Programming Glossary: glu.gluunproject

Android OpenGL ES 2.0 screen coordinates to world coordinates

http://stackoverflow.com/questions/10985487/android-opengl-es-2-0-screen-coordinates-to-world-coordinates

to convert screen coordinates where the user touches to world coordinates. I've tried reading and playing around with GLU.gluUnProject but I'm either doing it wrong or just don't understand it. This is my attempt.... public void getWorldFromScreen float x.. 0.0f 0.0f 0.0f float far 0.0f 0.0f 0.0f 0.0f float mv new float 16 Matrix.multiplyMM mv 0 mViewMatrix 0 mModelMatrix 0 GLU.gluUnProject x startY 0 mv 0 mProjectionMatrix 0 viewport 0 near 0 GLU.gluUnProject x startY 1 mv 0 mProjectionMatrix 0 viewport 0 far.. mv 0 mViewMatrix 0 mModelMatrix 0 GLU.gluUnProject x startY 0 mv 0 mProjectionMatrix 0 viewport 0 near 0 GLU.gluUnProject x startY 1 mv 0 mProjectionMatrix 0 viewport 0 far 0 float nearX near 0 near 3 float nearY near 1 near 3 float nearZ near..

Android OpenGL 3D picking

http://stackoverflow.com/questions/6699387/android-opengl-3d-picking

gl float realY float screenHeight pickY float nearCoords 0.0f 0.0f 0.0f 0.0f float farCoords 0.0f 0.0f 0.0f 0.0f GLU.gluUnProject screenWidth 2 screenHeight 2 0.0f mg.mModelView 0 mg.mProjection 0 viewport 0 nearCoords 0 GLU.gluUnProject screenWidth.. 0.0f 0.0f GLU.gluUnProject screenWidth 2 screenHeight 2 0.0f mg.mModelView 0 mg.mProjection 0 viewport 0 nearCoords 0 GLU.gluUnProject screenWidth 2 screenHeight 2 1.0f mg.mModelView 0 mg.mProjection 0 viewport 0 farCoords 0 System.out.println Near nearCoords.. it a float 4 and then divide all the resulting coordinates by the 4th one like so float xyzw 0 0 0 0 android.opengl.GLU.gluUnProject rx ry rz mg.mModelView 0 mg.mProjection 0 this.viewport 0 xyzw 0 xyzw 0 xyzw 3 xyzw 1 xyzw 3 xyzw 2 xyzw 3 xyzw 3 xyzw 3..