View Full Version : 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.
03-29-2000, 01:46 AM
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?!
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
03-29-2000, 02:24 AM
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.