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

Thread: retrieving transformed screen coordinates for 3d object

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2005
    Location
    West Lebanon, NH
    Posts
    4

    retrieving transformed screen coordinates for 3d object

    Hi guys,
    I'm wondering if you could help me with an OpenGL programming dilemma I have.

    I'm rendering a molecule using openGL, and each atom is a sphere centered around an (x, y, z) point. I want to add some text, slightly offset from the center of each sphere by a constant amount, say 20 pixels in the x and y directions. I'm using GLUT to draw the text, that's no problem. Problem is that I need to use glRasterPos3f() to set the raster position for the text drawing operation in 3d space, rather than 2d screen coordinates. This is good for getting the position of the centers of the atoms, but bad for offsetting the text by a constant amount in screen coordinates. My question is: is there an openGL or utility function, that will return the actual (x, y) screen coordinates of a position in 3D space, using the current transformation and projection matrices?

    Thanks,
    Ed Sanville

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2005
    Location
    West Lebanon, NH
    Posts
    4

    Re: retrieving transformed screen coordinates for 3d object

    Well, never mind, guys, a previous topic has answered my question! I am going to use the gluProject function to obtain screen coordinates from my 3d world coordinates.

    Thanks! Very useful message board!

Posting Permissions

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