Results 1 to 5 of 5

Thread: How do you draw with mouse on 3d landscape????

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2000
    Posts
    14

    How do you draw with mouse on 3d landscape????

    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.
    rgds
    Fyp2001

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: How do you draw with mouse on 3d landscape????

    see the selection buffer example on my site

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    Re: How do you draw with mouse on 3d landscape????

    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.
    Reality is for idiots only the best over come it!

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2000
    Posts
    14

    Re: How do you draw with mouse on 3d landscape????

    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?

  5. #5
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    Re: How do you draw with mouse on 3d landscape????

    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.
    Reality is for idiots only the best over come it!

Similar Threads

  1. Use mouse to draw rectangular VBO
    By RunningPig in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-04-2017, 01:44 AM
  2. opengl use mouse to draw lines
    By Pjoshi in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-25-2004, 02:44 AM
  3. Draw a mouse cursor!
    By pran1 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-17-2004, 09:59 AM
  4. How to draw trees on a 3d landscape?
    By StudentFYP in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 03-14-2001, 02:47 AM
  5. Glut mouse Draw in C or C++
    By Gl_glue in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 03-09-2001, 09:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean