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

lmbind Subroutine

Purpose

Makes a material, light, or lighting model definition active.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void lmbind(Int16 target, Int32 index)

FORTRAN Syntax

SUBROUTINE LMBIND(target, index)
INTEGER*4 target, index
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 lmbind subroutine takes a previously defined material, light, or lighting model and makes it active. Up to eight lights can be active (turned on) at the same time, but only one lighting model or material can be turned on at any time. Therefore, binding a material or lighting model automatically unbinds (deactivates) the previous lighting model or material.

The definition of a light, lighting model, or material (created previously with the lmdef subroutine) is not destroyed when one of these is unbound. The definition remains and can be rebound at a later time.

Notes:
  1. Some of the properties of the currently bound material can be changed on the fly with the lmcolor subroutine, which provides a highly efficient path for temporarily changing material properties. Using the lmcolor subroutine is much more efficient than employing a combination of the lmdef and lmbind subroutines.
  2. Lighting cannot be turned on and does not work if the matrix mode is not set to MVIEWING. The matrix mode can be changed with the mmode subroutine.
  3. The operation of this subroutine for the Supergraphics Processor Subsystem is modified. (See "Hardware Considerations" in GL3.2 Version 4 for AIX: Programming Concepts.)

Parameters

index Specifies the index into the table of previously defined materials, lights, or lighting models. Created with the lmdef subroutine.
target Specifies the target of the bind. There are 10 valid constants tokens that can be used for this parameter:
Constants
C FORTRAN Description
MATERIAL MATERI Indicates that the material definition passed by the index parameter should become the currently active material. Lighting can be turned off by binding index 0 to a material.
LIGHT0, LIGHT1, LIGHT2, LIGHT3, LIGHT4, LIGHT5, LIGHT6, LIGHT7 LIGHT0, LIGHT1, LIGHT2, LIGHT3, LIGHT4, LIGHT5, LIGHT6, LIGHT7 Indicate that the light definition passed by the index parameter should be bound to the respective light. Each light is distinct from the others and can be on or off. A light can be turned off by binding index 0 to it.
LMODEL LMODEL Indicates that the lighting model definition passed by the index parameter is the current lighting model. There can be only one current lighting model.

Example

The example C language program cylinder2.c uses the lmbind subroutine to use the materials, lights, and lighting model defined with the lmdef subroutine.

Implementation Specifics

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

Materials with different material properties on each side are now supported on the Gt4 class of graphics adapters and the GXT1000. Support for two-sided lighting is accomplished with the following token:

Target BACKMATERIAL
Function Indicates that the material definition passed by the index parameter should be used as the active material for back-facing polygons. Two-sided lighting must be enabled in order for this material definition to be used.

If two-sided lighting is enabled, and BACKMATERIAL is bound to a non-zero index, then the BACKMATERIAL properties are used for back-facing polygons, and MATERIAL properties are used for front-facing polygons. If two-sided lighting is enabled, and a zero index is bound to BACKMATERIAL, then the MATERIAL properties are used for both sides. If two-sided lighting is disabled, the material bound to BACKMATERIAL is not used.

Two-sided lighting applies only to polygons and triangles; it does not apply to points, lines and characters, where only the MATERIAL properties are used.

Target LIGHT0
Function The light position is transformed by the current matrix at the time the the light is bound. That is, the actual position that the light will have in world coordinates is determined by its defined position and the current matrix when it is bound. Subsequent changes to the matrix do not affect the light position. The position value stored in the light definition (as defined with the lmdef subroutine) is not affected or changed.
Description Lighting is disabled when index 0 (zero) is bound to either the MATERIAL or to the LMODEL (or both). Both the material and the lighting model must be bound to a non-zero index for lighting to be enabled. Even if all lights are off, lighting is still enabled, although only the emmisive material properties contribute to the lit color.
Note: If a light does not appear to be in the correct location, be sure that the current matrix had an appropriate value when the light was bound. The light position is transformed by the current matrix when the light is bound.

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

Specifying RGBA colors with a single packed 32-bit integer using the cpack subroutine.

Changing the target of the color commands with the lmcolor subroutine.

Making a new material, light source, or lighting model active with the lmdef subroutine.

Setting the current matrix mode with the mmode subroutine.

Specifying a normal vector with the n3f subroutine.

Updating the current normal vector with the normal subroutine.

Setting the current color in RGB mode with the RGBcolor subroutine.

AIX Graphics Library Overview, Creating Lighting Effects, and Setting Pipeline Options.


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