Tag: bulletphysics

将屏幕坐标转换为OpenGL坐标

我正在为Android创建一个骰子应用程序。 使用Kotlin,OpenGL-ES和jBullet。 我已经实施了骰子。 现在我需要创造墙壁,否则骰子会滚出屏幕。 因为屏幕可以有不同的长宽比,我试图用glUnProject来确定墙的位置,但我无法弄清楚。 我收到的坐标不正确。 gl.glViewport(0,0,width,height) //Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION) //Select The Projection Matrix gl.glLoadIdentity() //Reset The Projection Matrix //Calculate The Aspect Ratio Of The Window GLU.gluPerspective(gl, 35.0f, width.toFloat() / height.toFloat(), 0.1f, 100.0f) GLU.gluLookAt(gl, 0.0f, 30.0f, 0.0f, //Pos 0.0f, 0.0f, 0.0f, //Look at 0.0f, 0.0f, 1.0f //Up ); gl.glMatrixMode(GL10.GL_MODELVIEW) //Select The Modelview Matrix […]