Picking and Projecting in OpenGL
BlitzMax Forums/OpenGL Module/Picking and Projecting in OpenGL
| ||
How could you do things like CameraPick and CameraProject in OpenGL? NeHe's tutorial covers only how to get the picked object 'name', but not the picked pixel's coordinates. Could you get the depth of the picked pixel and convert it with the ModelView and Projection matrix into a vector that points at the picked 3D point? What if I need to pick several objects only and not all objects? The scene would have to be rendered again. How did Blitz3D do this? And could you use gluProject for that projection thingie? I hope anyone knows about that :) |
| ||
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. |