View Full Version : how to put make mouse lock on to an object ?
04-16-2001, 10:49 AM
Is it possible to have the mouse locked on a object when click left mouse button then the object( assume a sphere) move following the mouse movement in x,y and z plane.
how to do that?
Just using gl and glu, NOT glut.
( )( )
\ | | /
04-16-2001, 12:12 PM
OpenGL does not provide that functionality. In fact, it doesn't understand such concepts like objects or the existence of the mouse. If you want this functionality, you will have to:
1) Process the mouse clicking message for the OS you are using.
2) Figure out which polygon is being clicked on (OpenGL does have some functionality to help you here. Do a search for the selection buffer).
3) Figure out which object this polygon is a part of.
4) Process the mouse motion messages and translate the object around so that it follows the mouse.
Obviously, a non-trivial task.
04-17-2001, 06:26 AM
Doesn't Chapter 13 of the Red Book ( Woo) cover this? If you know the name of the object that you are on with the mouse then you can move the object to be drawn at the mouse position.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.