Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: place a 3d object of size 50 pixels at (x,y)

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2

    place a 3d object of size 50 pixels at (x,y)

    I am trying to track an object in the image. I need to place a 3d object at the image coordinates (x,y), and it must cover a certain pixel size (eg 50 pixels in width). The pixel size can vary during execution time.

    But i realise that the opengl command is: glutSolidCube(radius). How do i relate the number of pixels to radius, and place the cube at row x and column y of the image?

    [The image is displayed via orthogonal projection while the cube is using perspective projection]

    Please help! Thank you...Ü

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    U.S.
    Posts
    149

    Re: place a 3d object of size 50 pixels at (x,y)

    Originally posted by meahmeah:
    How do i relate the number of pixels to radius, and place the cube at row x and column y of the image?
    Use the frustum and window dimensions to calculate how large an object will be.

    If you're using a parallel projection, the radius-to-pixel size is a direct calculation. If you're using a perspective projection also take into consideration the perspective division.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2

    Re: place a 3d object of size 50 pixels at (x,y)

    thanks brcain! I manage to do it via glOrtho.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •