PDA

View Full Version : Display Lists



ToddAtWSU
10-17-2005, 02:31 AM
I am trying to draw a clock using display lists. I created a torus for the face, 2 cones for the minute and hour hands, and a 12 spheres for the 12 dots. I need to be able to grab the clock and move it around. So basically, I need to be able to grab anywhere on the torus (clock face) and move the clock around on the screen. But how do I know the coordinates of where the clock is located so I know if the mouse click occurred on the torus or not? :confused: Thanks for any help you have in helping me know if I am on the torus or not!

10-17-2005, 06:00 AM
Hi,

Search for keywords 'picking' 'selectionbuffer' or go to nehe.gamedev.net and take a look at the tutorial or look into the red book.

Using the selectionbuffer you give every object a name

glinitnames();
glpushnames(0); //initstack

then you switch the rendemode with glrenderMode(gl_selection)

glloadname(1); //e.g.for torus
drawobject()

collect the hits
...
etc.

cheers Boim

10-17-2005, 10:08 AM
here is a tutorial for picking in 3D:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=32

Obli
10-19-2005, 03:26 AM
Although for this time you may cut it with the selection buffer, I really suggest to avoid that way.
The problem of picking is something you really have to get in touch with. Sooner or later, you'll end up in it again.

Using ray/bounding box checks could be enough, but you obviously have to make sure you have both the BB and the ray in the same space (usually world space).

I'm not sure of the performances of the selection buffer but I personally would raccomand some care with it. Being hardware-driven, some implications may be nasty.