View Full Version : How do you draw with mouse on 3d landscape????
03-05-2001, 03:32 AM
How do you draw with mouse on 3d landscape???? I have created my 3d landscape and now i want the user to draw a closed area on the landscape that the user wants to place a feature eg tree on. I want the user to be able to draw only on the landscape and not on the screen above or below. I have no idea how to use mouse drawing in opengl and my attempts have resulted in the screen refreshing constantly and wiping out the mouse drawings. i am not using glut i am using nehe tutorials. Any suggestion/solutions will be apprieciated.
see the selection buffer example on my site
03-06-2001, 09:01 AM
Or you could use gluUnproject. You enter the 2d screen coordinates and the depth read from the depth buffer and it returns the 3d coordinate which you can then use to place your tree.
03-07-2001, 01:28 AM
Originally posted by Tim Stirling:
Or you could use gluUnproject. You enter the 2d screen coordinates and the depth read from the depth buffer and it returns the 3d coordinate which you can then use to place your tree. Where cani find more info on this gluproject function. Would it look like gluProject(2d cordinates,,depth buffer) where can i get the depth buffer what is it?
03-07-2001, 08:53 AM
I don't know of any tutorial sites that have it but it is in the redbook which you can get online. I havn't yet used it, hopefully in a couple of weeks I will have it running, so I can't give you any source. The redbook is linked at hehe's site. An example of gluUnproject is in chapter 3 (Viewing) in the redbook linked from nehe's site, you can also do a search.
To get the depth value for a screen x,y point you would use glReadPixels() set to read the depth buffer. Again I suggest you search the redbook for more help on this.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.