I’m trying to figure out how to render Axis in an editor I’m working on. I want to be able to display the axis for an object when the user clicks on the object, but for some reason I cannot get the axis to position correctly when the camera is moving around. Basically I set up my rendering like so…
SetUpPerspectiveProjection()
RenderModels()
if(ModelIsSelected) {
glOrtho(…)
glTranslatef(selectedmodel.x, selectedmodel.y, selectedmodel.z);
RenderAxis();
}
Just assume I called the appropriate glMatrixMode stuff already. What I’m confused about is what to set glOrtho parameters to. Right now I set them to (-10,10,-10,10,0.1,1000) and the Axis being rendered have a length of 1. But when I move the camera up or down or look to the side, the axis swerve way off away from the model.
How can I get the axis to always stay exactly where the model is?
Also, the reason I’m trying to do this with glOrtho is that I want the axis to stay the same size in the window no matter how far away the model is. I’m basically trying to reproduce the gizmo 3dsmax has while you’re editing.