[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]

*GL3.2 for AIX: Graphics Library (GL) Technical Reference*

## lookat Subroutine

### Purpose

Defines a viewing transformation.

### Libraries

Graphics Library

C (**libgl.a**)

FORTRAN (**libfgl.a**)

### C Syntax

**void lookat**
**(Coord ***viewx***,Coord** *viewy***, Coord** *viewz***,**
**Coord** *pointx***,** **Coord** *pointy***, Coord** *pointz***,**
**Angle** *twist***)**

### FORTRAN Syntax

**SUBROUTINE LOOKAT(***viewx***, ***viewy***, ***viewz***, ***pointx***, ***pointy***, ***pointz***, ***twist***) **
**REAL*4 ***viewx***, ***viewy***, ***viewz***, ***pointx***, ***pointy***, ***pointz*
**INTEGER*4 ***twist*

**Note: **For FORTRAN users, this subroutine accepts long integer parameters (INTEGER*4) when invoked from a FORTRAN program, although it accepts short integers when invoked from a C program. The C and FORTRAN syntax shown here reflect this difference.

### Description

The **lookat **subroutine defines the viewpoint and a reference point on the line of sight in
world coordinates. The viewpoint is at (*viewx*, *viewy*, *viewz*), and is the position from which you are looking. The reference point is at (*pointx**, **pointy*, *pointz*), and is the location on which the viewpoint is centered. If *pointx*, *pointy*, and *pointz* are 0, you are looking at the origin of the world coordinate system. The viewpoint and reference point define the line of sight. The *twist* parameter measures right-hand rotation about the line of sight.

Normally, the **lookat** subrotuine is used to set up the mapping from world coordinates to eye coordinates (equivalently, to define the location of the viewer's eye in world coordinates). If the **lookat** subroutine is the first transformation subroutine called after projection matrix is set up and the matrix stack is initialized, it sets up such a mapping.

The **lookat** subroutine can also be used as a modeling transformation. Whether it behaves as a viewing transformation or a modeling transformation depends on the order in which it is called with respect to the other transformation subroutines and with respect to the drawing subroutines.

### Parameters

*viewx* |
Specifies the *x* coordinate of the viewing point. |

*viewy* |
Specifies the *y* coordinate of the viewing point. |

*viewz* |
Specifies the *z* coordinate of the viewing point. |

*pointx* |
Specifies the *x* coordinate of the reference point. |

*pointy* |
Specifies the *y* coordinate of the reference point. |

*pointz* |
Specifies the *z* coordinate of the reference point. |

*twist* |
Specifies the angle of rotation. |

### Example

The example C language program **zbuffer1.c** uses the **lookat** subroutine to define the point of view.

### 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

Defining the viewer's position in polar coordinates with the **polarview** subroutine.

AIX Graphics Library Overview and Working with Coordinate Systems.

[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]