[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

ortho or ortho2 Subroutine

Purpose

Defines an orthographic transformation.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void ortho
(Coord left, Coord right,
Coord bottom, Coord top,
Coord near, Coord far)
void ortho2
(Coord left, Coord right,
Coord bottom, Coord top)

FORTRAN Syntax

SUBROUTINE ORTHO(left, right, bottom, top, near, far)
REAL left, right, bottom, top, near, far
SUBROUTINE ORTHO2(left, right, bottom, top)
REAL left, right, bottom, top

The foregoing routines are functionally the same. They differ only in that the ortho subroutine is used for 3-D applications and the ortho2 subroutine is used for 2-D applications.

Description

The ortho and ortho2 subroutines set the current projection transformation to be an orthographic perspective transformation. With an orthographic projection, figures do not get smaller as they recede in relation to the viewer. Orthographic projections also preserve angles.

The ortho subroutine specifies a box-shaped enclosure in the eye coordinate system that is mapped to the viewport. The left, right, bottom, top parameters are the x and y clipping planes. The near and far parameters are distances along the line of sight from the eye screen origin, and can be negative. The z clipping planes are at -near and -far.

The ortho2 subroutine defines a 2-D clipping rectangle. When you use this subroutine with 3-D modeling coordinates, the z values are not transformed. Objects with z values outside the range -1 <= z <=1 are clipped out.

When the system is in single matrix mode, both the ortho and ortho2 subroutines load a matrix onto the matrix stack, thus replacing the current top matrix. When the system is in viewing matrix mode or projection matrix mode, it replaces the current projection matrix without changing the matrix stack.

To be more technically accurate, the ortho and ortho2 subroutines set the mapping from eye coordinates to normalized device coordinates (NDC). Clipping occurs in NDC; all drawing primitives (except for text and blits) are clipped to -w <= x, y, z <= +w. The map is such that the clipping plane -w=x (in NDC) appears to be at +w*left = x in eye coordinates, and so on for the other five sides. For most drawing primitives, w=1.

After the ortho subroutine completes, the eye coordinate system is set up so that x is to the right, y is up, and z is towards the viewer (out of the screen).

Parameters

left Specifies the coordinate for the left vertical clipping plane.
right Specifies the coordinate for the right vertical clipping plane.
bottom Specifies the coordinate for the bottom horizontal clipping plane.
top Specifies the coordinate for the top horizontal clipping plane.
near Specifies the coordinate for the nearest depth clipping plane.
far Specifies the coordinate for the farthest depth clipping plane.

Examples

  1. The example C language program paint.c uses the ortho2 subroutine to define the two-dimensional world coordinates that exactly fit the defined viewport.
  2. The example C language program backface.c uses the ortho subroutine to map a rectangular volume of space to the viewport.

Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows/3D Feature.

Files

/usr/include/gl/gl.h Contains C language constant and variable type definitions for GL.
/usr/include/gl/fgl.h Contains FORTRAN constant and variable type definitions for GL.

Related Information

Setting the current matrix mode with the mmode subroutine.

Defining a perspective projection transformation in terms of a field of view with the perspective subroutine.

Defining a perspective projection transformation in terms of x and y coordinates with the window subroutine.

AIX Graphics Library Overview and Working with Coordinate Systems.


[ Previous | Next | Contents | Glossary | Home | Search ]