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

## normal Subroutine

### Purpose

Sets the current normal vector.

### Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

### C Syntax

`void normal(Coord narray)`

### FORTRAN Syntax

```SUBROUTINE NORMAL(narray)
REAL narray(3)```

### Description

The normal subroutine sets the current normal vector. The x, y, and z modeling coordinates stored in the parameter narray are transformed into eye coordinates using the inverse transpose of the current viewing matrix. These numbers are used to set the value for the current vertex normal.

The passed parameter (narray) becomes the current normal and is used when the lighting algorithm is rerun for all subsequent vertices. It is not necessary to respecify a normal if it is unchanged. For example, a single call to the n3f subroutine is sufficient for a flat-shaded polygon. However, the n3f subroutine must be called before the first vertex subroutine.

Lighting calculations assume that the specified normal is of unit length, as shown in the following equation:

`   x`
2 + y2 + z2 = 1.0

If the normal does not equal 1.0, or if no lighting model is active, the results are unpredictable.

The normal and n3f subroutines are the same in all respects.

### Parameter

narray Specifies the address of an array containing three floating point numbers representing the x, y, and z model coordinates. Corresponding indexes for these coordinates are:
 Model Coordinate C Index FORTRAN Index x 0 1 y 1 2 z 2 3

### Implementation Specifics

This subroutine is part 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

Binding a new material, light, or lighting model definition with the lmbind subroutine.

Defining a new material, light, or lighting model with the lmdef subroutine.

Specifying a normal for lighting calculations with the n3f subroutine.

AIX Graphics Library Overview, Creating Lighting Effects, Drawing with Begin-End Style Subroutines, and Understanding the Hardware Used by GL in GL3.2 Version 4 for AIX: Programming Concepts.

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