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 4 of 4

Thread: object position

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2006
    Location
    india
    Posts
    2

    object position

    I am a newbee for open gl. I have created a window with two glut primitives- a sphere and a cube. Now, how can i find the present position of the primitives and how can i reset the positions related to the present positions(20 pix in x-direction from the present position). I am using VC++ 6 and open GL.
    can some one explain please?
    LEOrus
    leo

  2. #2
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: object position

    You need to manipulate the modelview matrix stack to position, rotate, and scale your GLUT spheres and cubes.

    http://www.rush3d.com/reference/open...chapter03.html

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2006
    Location
    india
    Posts
    2

    Re: object position

    yes. chapter 3 of redbook explains how to use the modelview matrix to manipulate the position and angle of an object. But I want to get the position of an object in the 3d coord. system at any given time.It is like getObjectPosition() and setObjectPosition() or position an object at a particular point(x,y,z).
    How to do this?

    leo
    leo

  4. #4
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: object position

    Typical approach looks like this:
    -application knows where objects are
    -application sets up matrices to place an object in proper position
    -application renders an object

    So asking OpenGL for object's position in 3D is more less like asking:
    "Tell me what I have just told you".

    Another case is when you want to know where object is on the screen after rendering - for this you can use feedback mode.
    Or you can as OpenGL what objects are at given position on the screen - this is selection mode.

Posting Permissions

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