Axis Alignment

I am not sure where to ask this, but since I am a beginner I will ask.
I have a ASCII file of X, Y, and Z Coordinates that make up a polygon and could be any arbitary values (may or may not be centered). I would like to make sure that the polygon is “axis aligned” so that when I first load the polygon I am looking at the model “dead-on center” not at any kind of angle (which it could be according to the specific ASCII files local coordinate system). Can anyone tell me what is the most practical way to do this with OpenGL?

Also, thanks for all the help I have received from everybody on this board. You all really know your graphics programming :slight_smile:

Do you mean you want the surface normal of the polygon to be parallel to the viewing direction?

In that case, first calculate the normal from the vertices, calculate the center of the polygon, push that point outward with the normal and then use then use gluLookAt to setup the view.

If you just want to center the view on the geometry, read this:
http://www.opengl.org/resources/faq/technical/viewing.htm#view0070

Thank you remdul. I will read the view on geometry link.