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

cpack Subroutine

Purpose

Specifies RGBA color with a single packed 32-bit integer.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void cpack(unsigned Int32 pack)

FORTRAN Syntax

SUBROUTINE CPACK(pack)
INTEGER*4 pack

Description

The cpack subroutine changes the current RGBA (red, green, blue, alpha) values. It is valid only in RGB mode. Red is the least significant byte in the packed integer, then green, blue, and alpha. Components must range from 0 through 255. For example,

cpack(0xFF004080); 

sets red to 0x80 , green to 0x40 , blue to 0x0 , and alpha to 0xFF . On systems without alpha bitplanes, set the alpha bit values to zero.

Note that the cpack subroutine can be used while a lighting model is active.

Parameter

pack Specifies a packed integer containing the RGBA (red, green, blue, alpha) values to assign as the current color.

Example

To clear the screen to black, then set the color to white, the example C language program localatten.c calls the cpack subroutine with a value of 0 (black) before a clear subroutine, then calls the cpack subroutine with a value of 0xFFFFFF (white).

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

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

Setting the current color in color map mode with the color subroutine.

Returning the current color in color map mode with the getcolor subroutine.

Returning the current color in RGB mode with the gRGBcolor subroutine.

Setting the current color in RGB mode with the RGBcolor 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 ]