Results 1 to 4 of 4

Thread: Getting Coordinates of points on Sphere

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2002
    Posts
    2

    Getting Coordinates of points on Sphere

    I'm trying to calculate the real world coordinates of a point on a sphere with texture map, from the coordinates of a mouse click.

    I have experimented with gluUnproject but I seem to be getting nonsense for output!
    I'm not really sure how to use glDepthRange() to get the z coordinates - I've tried using glReadPixel to get this but I always seem to get the same value wherever I click the mouse.

    Any help would be greatly appreciated!


    [This message has been edited by gevans2000 (edited 11-19-2002).]

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: Getting Coordinates of points on Sphere

    As far as I remember equeation is as follows: x^2+y^2+z^2=R^2 so if you have x,y & of course you know R then it's just the math you need

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: Getting Coordinates of points on Sphere

    real world as in screen coords? If you want screen coords use gluunproject, if you want the x,y,z then use gluproject with the mouse x, y.

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2002
    Posts
    2

    Re: Getting Coordinates of points on Sphere

    I have used gluUnpoject and I'm getting the z value from glReadPixels. This always seems to give the same value though. I've read somewhere that if the near clip frame is to close to the camera position then glReadpixels can be inaccurate - any ideas how close it means. At the moment my sphere has radius 1.0 and my camera is at (0.0,0.0,3.0) with the near clip frame 1.0 away from the camera. Is this too close? Could this cause the z value read from glReadPixels to always be the same (very small) number?

Similar Threads

  1. Random Points on the surface of a Sphere (Star Effect)
    By Carl Jokl in forum OpenGL: General
    Replies: 8
    Last Post: 02-09-2007, 12:54 PM
  2. Drawing Arcs Connecting Two Points on a Sphere
    By Gonff in forum OpenGL: General
    Replies: 1
    Last Post: 08-20-2006, 05:03 AM
  3. Frustrum Points Coordinates
    By Antorian in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 09-02-2002, 12:30 PM
  4. Frustrum Points Coordinates
    By Antorian in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 09-02-2002, 11:01 AM

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