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
    Senior Member Regular Contributor
    Join Date
    Sep 2011
    Posts
    150

    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.

Similar Threads

  1. Scale geometry to fixed size in pixels
    By AlHadr in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-15-2012, 02:02 PM
  2. Getting actual viewport size in pixels...
    By M/\dm/\n in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-29-2004, 10:27 AM
  3. drag and place 3d object
    By adityask in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 03-16-2002, 09:33 AM
  4. drag and place 3d object
    By adityask in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-15-2002, 05:35 AM
  5. Rendering an object in more than one place
    By King Fuzzy in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-25-2001, 10:47 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