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

linesmooth Subroutine

Purpose

Turns line antialiasing on and off.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void linesmooth(Int32 mode )

FORTRAN Syntax

SUBROUTINE LINESM(mode)
INTEGER*4 mode

Description

The linesmooth subroutine allows the drawing of antialiased lines in color map and RGB modes.

In RGB mode, the current color is blended with the contents of the frame buffer in a read-modify-write operation. That is, the new pixel color is a calculated blend of the old pixel color and the current color, based on the percentage of overlap of the line with the pixel.

In color map mode, the low-order 4 bits of the current color index are replaced with a value representing the pixel coverage. Therefore, a color ramp must be loaded, with the low-order 4 bits of the color ramp blending between the foreground and background colors.

This type of color-index antialiasing hardware design allows the user to implement one of several antialiasing algorithms. One algorithm draws monocolored lines on a multicolored background; the other draws multicolored lines on a monochrome background. Refer to the section on "Smoothing Jagged Lines with Antialiasing" in GL3.2 Version 4 for AIX: Programming Concepts for examples and further detail.

Only solid (nonpatterned), unit-width lines are supported. That is, for antialiased lines to be drawn correctly, set linewidth=1 using the linewidth subroutine, linestyle=0xffff using the deflinestyle subroutine, and lsrepeat=1 using the lsrepeat subroutine.

  1. In order for antialiased lines and points to be displayed as visually smooth, gamma correction must be performed. A gamma correction factor in the range of 2.4 to 2.7 is suggested. If gamma correction is not performed, lines are not displayed as smooth, but exhibit a roping or braiding effect, as if the line were composed of separate, intertwining strands. For more information on gamma-correcting antialiased lines, see "Smoothing Jagged Lines with Antialiasing" in GL3.2 Version 4 for AIX: Programming Concepts.
  2. Only solid, single, pixel-wide lines can be antialiased, and they cannot be used in conjunction with shading processor functions such as z-buffer, light, shade, and depth cue.

Parameter

mode Sets line-drawing mode as follows:
Mode Constants
C FORTRAN Description
SML_ON SMLON Enables smooth lines.
SML_OFF SMLOFF Disables smooth lines.

Example

The example C language program alias.c uses the linesmooth subroutine to draw antialiased lines. Other examples that use the linesmooth subroutine include the alias_fore.c and alias_back.c example programs.

Implementation Specifics

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

  1. The 3-D Color Graphics Processor supports antialiased lines only in color map mode. Only solid (nonpatterned) unit width lines are supported. On this adapter, the value 0xf represents maximum pixel coverage, and 0x0 represents minimum pixel coverage. That is, the following color ramp should be loaded:
    3-D Display Graphics Processor Color Ramp
    Low-Order 4 Bits Ramp
    0000 (1/16) * foreground color + (15/16) * background color
    0001 (2/16) * foreground color + (14/16) * background color
    0010 (3/16) * foreground color + (13/16) * background color
    . . . . . . . . . .
    1111 (16/16) * foreground color + (0/16) * background color
    For the 3-D Color Graphics Processor, the appearance of the intersections of color-index-mode antialiased lines and points can be significantly improved by setting the value of the zsource subroutine to ZSRC_COLOR and the value of the zfunction subroutine to ZF_GREATER. Refer to the subsection on improving intersections within "Smoothing Jagged Lines with Antialiasing" in GL3.2 Version 4 for AIX: Programming Concepts for more details.
  2. The Supergraphics Processor supports antialiased lines in RGB mode only. Only solid (nonpatterned) unit width lines are supported.
  3. The POWER Gt4 and POWER Gt4x adapters support antialiasing in both RGB and color index modes. For these adapters, RGB-mode antialiased lines are drawn significantly slower than normal lines. For these adapters, the appearance of the intersections of color-index-mode antialiased lines can be improved significantly by setting the value of the logicops subroutine to LO_MAX.
  4. The 8-bit POWERstation 730 and the 8-bit POWERgraphics GTO adapter do not support the drawing of antialiased lines. The 24-bit option must be installed for antialiased line support.
  5. When anti-aliased lines and points are drawn in RGB mode, a coverage factor (alpha value) for pixels on and near the anti-aliased objects is computed. This coverage factor is used to blend the color of the anti-aliased point or line with the contents of the frame buffer. The way in which the blending occurs is controlled by the blendfunction subroutine. When rendering anti-aliased objects in RGB mode, set the blendfunction to an appropriate value.
  6. The POWERgraphics GXT1000 supports anti-aliased line rendering in both color-index and RGB rendering modes.

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 antialiasing of points with the pntsmooth subroutine.

Controlling the placement of point, line, and polygon vertices with the subpixel subroutine.

Smoothing Jagged Lines with Antialiasing, Understanding the Hardware Used by GL, Working in Color Map and RGB Modes, Setting Drawing Attributes.


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