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

color or colorf Subroutine

Purpose

Sets the current color in color map mode.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void  color(Colorindex color)
void  colorf(Float32 color)

FORTRAN Syntax

SUBROUTINE COLOR(color)
INTEGER*4 color
SUBROUTINE COLORF(color)
REAL color

Description

The color subroutine selects a color from the color map, and sets that color as the default in the current drawing mode. For example, if the drawing mode is NORMALDRAW (the default), the color index is written to the standard bitplanes during all drawing routines.

In NORMALDRAW mode, the color parameter allows you to access up to 12 bitplanes in onemap mode and up to 8 bitplanes in multimap mode. However, since the 8-bit High-Performance 3-D Color Graphics Processor has only one 8-bit main frame buffer, the 12-bit onemap mode is not available on this machine.

In OVERDRAW and UNDERDRAW modes, 0, 2, or 4 bitplanes are accessible.

In alternate drawing modes such as OVERDRAW the color subroutine serves the same function as in NORMALDRAW, except that different bitplanes are used, and a separate, smaller map is indexed.

The colorf subroutine is identical to the color subroutine, except that it expects a floating point color index. Before the color is written into display memory, it is rounded to the nearest integer value. When drawing with the GOURAUD shading model, machines that iterate color indexes with fractional precision yield more precise shading results using the colorf subroutine than with the color subroutine. The results of these subroutines are indistinguishable when drawing with FLAT shading.

The color and colorf subroutines serve no purpose in RGB mode because the RGB components of the color are written directly to the bitplanes.

Parameter

color Specifies a color index (0 to 4095 in onemap mode, 0 to 255 in multimap mode).

Example

The example C language program boxcirc.c uses the color subroutine to set the color for subsequent drawing routines.

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

Choosing a set of bitplanes for drawing with the drawmode subroutine.

Returning the current color with the getcolor subroutine.

Getting a copy of the RGB values for a color map entry with the getmcolor subroutine.

Changing a color map entry with the mapcolor subroutine.

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

Setting a display mode that bypasses the color map with the RGBmode subroutine.

Gaining write access to a subset of available bitplanes with the RGBwritemask subroutine.

Gaining write access to the available bitplanes with the writemask subroutine.

AIX Graphics Library Overview, Setting Drawing Attributes, Understanding the Hardware Used by GL, and Working in Color Map and RGB Modes.


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