Picking and Projecting in OpenGL

BlitzMax Forums/BlitzMax OpenGL Programming/Picking and Projecting in OpenGL

It's late, but i reply. :)
This can be help other.

Local SX:Double
Local SY:Double
Local SZ:Double
Local MVMatrix:Double[16]
Local ProjMat:Double[16]
Local VPort:Int[4]
glGetDoublev(GL_MODELVIEW_MATRIX,Varptr MVMatrix[0])
glGetDoublev(GL_PROJECTION_MATRIX,Varptr ProjMat[0])
glGetIntegerv(GL_VIEWPORT,Varptr VPort[0])
gluProject(ObjX,ObjY,ObjZ,MVMatrix,ProjMat,VPort, Varptr SX, Varptr SY, Varptr SZ)


Transform X,Y,Z Obj coordinates to screen coordinate, result in SX,SY and SZ.