View Full Version : 3d GLOrtho and glulookat

01-06-2016, 08:44 AM

I have a an ordnance survey scene, with a North axis, east axis and the elevation axis.

I have the Maximum vale for the easting East = 30, Minimum value for the easting East = - 30
Maximum North = 118, minimum North = -118
Maximum elevation = 12, minimum elevation = -12

What values should I have in glOrtho and gluLookAt so I can see it?

Any help gratefully appreciated.


01-06-2016, 12:41 PM
gluLookAt will set the translation and rotation, glOrtho() will set the scale.

The parameters for gluLookAt() are the eye position and some position within the region of interest, both in map coordinates.

The parameters for glOrtho() should either be derived from the size of the visible region, or from a fixed constant (with the scale applied to the model-view transformation rather than the projection transformation). Typically, left+right=0 and top+bottom=0 so that the view origin is in the centre of the viewport, and (right-left)/(top-bottom) should match the aspect ratio of the viewport.

If you want to scale the view so that a given region (after any transformations) fits within the viewport, then you need to transform the vertices of the region, find their bounding box, then adjust the scale (and possibly the offset) accordingly, either by changing the glOrtho() parameters or by adding a scale (to the right of the projection transformation or to the left of the model-view transformation).

01-06-2016, 01:04 PM
Thanks I appreciate what you say but I have not been able to get it to work and I thought someone could give me the values I need to use to get a view to work.