View Full Version : Display Lists
10-17-2005, 03: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!
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
then you switch the rendemode with glrenderMode(gl_selection)
glloadname(1); //e.g.for torus
collect the hits
here is a tutorial for picking in 3D:
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.