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

## n3f Subroutine

### Purpose

Specifies a normal vector for lighting calculations.

### Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

### C Syntax

`void n3f(Float32 vector  )`

### FORTRAN Syntax

```SUBROUTINE N3F(vector)
REAL vector (3)```

### Description

The n3f subroutine specifies the normal vector to be used for lighting calculations.

The passed parameter (vector) 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.

When called with unequal arguments, the scale subroutine or any other nonorthonomial transformation causes a matrix skew that is corrected by renormalizing every normal. Lighting performance is reduced in this event.

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

### Parameter

vector Specifies the address of an array containing three floating point numbers. These numbers are used to set the value for the current vertex normal.
Vector components are:
 Vector Component C Index FORTRAN Index Nx 0 1 Ny 1 2 Nz 2 3

### Example

The example C language program cylinder2.c calls the n3f subroutine between the bgnpolygon subroutine and the endpolygon subroutine to specify the normal vectors of a polygon.

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

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 current normal vector for lighting calculations with the normal subroutine.

AIX Graphics Library Overview, Creating Lighting Effects, Drawing with Begin-End Style Subroutines, and Understanding the Hardware Used by GL.

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