PDA

View Full Version : How to render a scene from "Left" or "top" view just like 3D max?



pango
06-17-2007, 05:56 AM
My program need to render a scene from "left" or "top" view angle,it just like 3DMax's

"Left","Top","Right",... view,I write my program like below to implement:

// Render Scene from "Top" View angle;
Vector3f eye(0,YValue,0); // "YValue" is the problem I puzzled
Vector3f view(0,0,0);
Vector3f up(0,0,-1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Change Camera Params to simulate view angle
gluLookAt(eye.X(),eye.Y(),eye.Z(),
view.X(),view.Y(),view.Z(),
up.X(),up.Y(),up.Z()
);
// Render Scene
...

to another view angle,change the value of eye's X,or Y,or Z,but the problem is I don't how to set the

value of "YValue",I attempt to use the side value of scene bouning box,but the effect is not satisfying,so

anyone can tell me how to calculate "YValue"?Is there any code demonstrate render a scene from "Top",or

"Front" view angle?

knackered
06-17-2007, 08:25 AM
this isn't advanced, post your question in the beginners forum.