Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Look at

  1. #1

    Look at

    I hava a problem looking at objects. I have a measureinstrument that I want to be oriented in the right upper corner, and it shall not be moved or rotated. Then I have a object that I want to look at in different angels whith glLookAt(). How can I do so that measureinstrument stays in the right upper corner,unrotated, while the object that I look at rotate.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2000

    Re: Look at

    Dont know what the measureinstrument is or how you represent it. If its possible to draw the measurething in 2D I would draw the 3D stuff and then switch to 2D view and draw the measurething where it supposed to be..

    Otherwise, if it needs to be 3d, you must keep track of the camera position and orientation.

    Maybe take the vector from the camera position to the objects center, do some crossproducts with up vector and the result vector from that product. Then build some transformmatrix from those vectors, use it and translate a bit and then draw the measure thing..

    Or maybe one can get the current matrix with some glget call.. doh

    I would try drawing it in 2D if thats possible.

    What are you doing anyway?!


  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000

    Re: Look at


    A way of doind this in 3D without knowing the camera position/direction is:

    push modelview matrix with glPushMatrix()
    load modelview with identity matrix with glLoadIdentity()
    now you can draw your instrument by placing them in 3D-space so they end up in the corner (this position can be precalculated, sice you will always have the same cameraposition after loading the identitymatrix, and it's (0,0,0) looking down -Z axis)
    pop the old modelview matrix with glPopMatrix and your camera is back at the old position


  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2000

    Re: Look at

    Double doh.

Posting Permissions

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