Small axes in corner with gluLookAt + gluPerspective

Hi,

I have a problem that I’m unable to resolve.

I’m trying to draw small XYZ axes in the corner like a lot of programs. The problem is that all the codes I produce or all the codes I find on the web draw the axes like in an Ortho view (such as here and here).

Indeed, the vertical axis (Z in my case) is always vertical, even when it is not in my perspective view.

Here is an exemple :

Thanks,

Benjamin

The easiest is to set a small viewport ( like 0,0,50,50) and render the axes as unit lines with a camera with eye = normalise(current_camera_lookat - current_camera_eye) * 4, lookat = 0,0,0, up = 0,1,0. You may need to adjust how far the the new eye point
is from the origin (thats what the * 4 does)

[QUOTE=tonyo_au;1245008]The easiest is to set a small viewport ( like 0,0,50,50) and render the axes as unit lines with a camera with eye = normalise(current_camera_lookat - current_camera_eye) * 4, lookat = 0,0,0, up = 0,1,0. You may need to adjust how far the the new eye point
is from the origin (thats what the * 4 does)[/QUOTE]

Actually, it’s what I’m doing now. It’s more curiosity than another thing since the axes are in reality the same as the small axes. But I never found a solution to this question.

Thanks for your answer.

Benjamin

Not sure what you’re asking. Most people would be satisfied with what you have in the image you posted.
How do you want the little triad to look in that image?
Do you want the blue axis to be tilted at the same angle as the blue line coming out of the top of the pyramid?
If you translate the pyramid to the left side of the screen the blue line would be tilted the other way.
Would you want the little corner triad to tilt the other way too?
Most people don’t want this because it does not reflect the true orientation of the main coordinate system.
The blue line coming out of the top of the pyramid is tilted because it’s been translated away from the origin.
AND - because it’s perspective projection. If you translate the pyramid to the center of the FOV of the camera,
the lines coming out of the pyramid will be parallel to the little triad in the corner.
Usually people want a small, corner triad, to show the orientation of things in the center of the FOV.
If you can explain clearly what you’d like to see, people will make suggestions.
But they may not be as trivial as you hoped.