Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shade_mode(3G) — HP-UX 5.50

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

light_source(3G)

light_switch(3G)

shade_range(3G)

surface_model(3G)

vertex_format(3G)

SHADE_MODE(3G)

NAME

shade_mode − enable/disable light source polygon shading. 

SYNOPSIS

C Syntax:

void shade_mode(fildes,mode,shading);
int fildes,mode,shading;

FORTRAN77 Syntax:

shade_mode(fildes,mode,shading)
integer*4 fildes,mode,shading

Pascal Syntax:

procedure shade_mode(fildes,mode,shading:integer);

DESCRIPTION

Input Parameters

fildes Integer file descriptor returned by open when an I/O path to a graphics device is opened. 

mode Specifies Starbase color map setup: CMAP_NORMAL, CMAP_MONOTONIC, and CMAP_FULL.  Can be ORed with INIT to initialize color map. 

shading
If TRUE (1), filled polygons are processed through the light source equations. 

Discussion

The mode parameter specifies how the color map is interpreted:

CMAP_NORMAL
This is the default mode.  The color table is searched for the color closest to the one requested for procedures such as fill_color and line_color. CMAP_NORMAL cannot be used if shading or depth cueing is on, or color coordinates are being used for output primitives.  If INIT is ORed, the color map is initialized to its default state.  In this mode, a 24-plane graphics device behaves as a standard 8-plane device. 

CMAP_MONOTONIC
This mode assumes a monotonicaly increasing intensity between the color map indices set by shade_range. All color values are converted to intensities by the equation:
I=0.30(red)+0.59(green)+0.11(blue)
This intensity value is then mapped to an index using the min and max specified by shade_range. If INIT is ORed, the color map is initialized to a linear grey scale between the lowest index and the highest index.  A 24-plane graphics device behaves like a standard 8-plane device. 

CMAP_FULL In this mode, color mapping is assumed as follows:

 (8-plane) or (16 plane double-buffered) graphics device:
3 bits red, 3 bits green, and 2 bits blue.

 (4-plane) or (8 plane double-buffered) graphics device:
1 bit red, 2 bits green, and 1 bit blue.

 (3-plane) or (6 plane double-buffered) graphics device:
1 bit red, 1 bit green, and 1 bit blue.

 (6-plane) graphics device:
2 bits red, 2 bits green, and 2 bits blue.

 (24-plane) graphics device:
8 bits red, 8 bits green, and 8 bits blue or
4 bits red, 4 bits green, and 4 bits blue if double-buffered.

CMAP_FULL can be specfied only if the graphics device has 3 or more planes.  CMAP_FULL requires at least 3 planes per buffer when double-buffering is used.  If INIT is ORed, the color map is initialized according to the above assumptions. 

(Note:  the 98721 driver requires at least 8 planes in the CMAP_FULL mode, or at least 16 planes if double-buffered). 

When shading is FALSE (0), light sources are not applied to polygons.  When shading is TRUE (1), the light source equations, as defined by surface_model are used to determine the polygon colors.  Note that if all the lights are disabled by light_switch, polygons will not be seen. The vertex_format procedure is used to obtain various shading effects such as constant (faceted) shading and RGB interpolation (smooth or Gouraud) shading. 

Current colors are recalculated using the current color map mode. 

shade_mode may change current bank usage (see bank_switch). Since unused banks are sometimes used for the zbuffer when hidden surface removal is enabled, changing the color map mode when hidden surface removal is enabled is not permitted. For example, if the color map mode is CMAP_NORMAL when hidden surface removal is turned on, no more than two banks will be in use.  If additional banks are available in the device, they may be allocated for zbuffer usage.  This means that if the color map mode were later changed to CMAP_FULL, up to three banks could be used for image space, resulting in a collision if the third bank was being used for the zbuffer.  Such a change could also increase the number of passes needed to fully render an image, so simply recalculating the zbuffer allocation would not produce a satisfactory solution.  For this reason, the color map mode should be set before hidden surface removal is enabled.  If the color map mode needs to be changed, hidden surface removal should be disabled before the change is made. 

Performance Note: Color calculations for fill_color, line_color, perimeter_color, background_color, text_color, and marker_color are much faster for the CMAP_FULL and CMAP_MONOTONIC modes than the CMAP_NORMAL mode.  This is because the colors can be calculated as opposed to searching the color map for the closest colors. 

DEFAULTS

mode = CMAP_NORMAL,
shading = FALSE (0). 

SEE ALSO

light_source(3G), light_switch(3G), shade_range(3G), surface_model(3G), vertex_format(3G),
Starbase Graphics Techniques.

Hewlett-Packard Company  —  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026