def unproject(self, x, y, z, auto_flip_vertical=True): modelview_mat = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX) projection_mat = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX) viewport = GL.glGetIntegerv(GL.GL_VIEWPORT) if auto_flip_vertical: y = viewport[-1] - y ret = GLU.gluUnproject(x, y, z, modelview_mat, projection_mat, viewport) return ret