Re: [PyOpenGL-Users] OpenGl + Mouse Selection
Brought to you by:
mcfletch
From: Gary H. <gh...@is...> - 2003-04-21 19:40:43
|
On Monday 21 April 2003 12:11 pm, Jasper Phillips wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I want to be able to "select" different entities rendered in OpenGL w/ > a mouse -- essentially asking which shape the mouse pointer is over. > Ideally this could be used to select game pieces to move, etc. > > This is fairly easy to compute when rending in an orthographic view, as you > can simply translate mouse coordinates to viewpane coordinates. However, > this doesn't work well for perspective views! > > It would be nice to simply ask opengl what lies behind a certain screen > coordinate, but I haven't been able to find anything amongst the "glut" > (rimshot!) of opengl documentation about this. > > Has anyone here had any experience with something like this? I suspect > there must be an easy way to do it, as obviously the information is > available inside of opengl. OpenGL has a way to do this. Look at glSelectBuffer, and also glInitNames, glLoadName, glPushName, and gluPickMaatrix. Like most things in OpenGL, these are low level tools which provide much power, but will take a little time to learn to use. Good Luck, Gary Herron |