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

subpixel Subroutine

Controls the placement of point, line, and polygon vertices

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void subpixel(Int32 bool )

FORTRAN Syntax

SUBROUTINE SUBPIX(bool)
LOGICAL bool

Description

The subpixel subroutine controls the placement of point, line, and poygon vertices in screen coordinates. The default value of the bool parameter is False, causing vertices to be snapped to the center of the nearest pixel after they have been transformed to screen coordinates.

Vertex snapping introduces artifacts into the scan conversion of lines and polygons. It is especially noticeable when points or lines are drawn smooth (see the pntsmooth and linesmooth subroutines). The subpixel subroutine is typically set to True while smooth points or smooth lines are being drawn.

In addition to its effect on vertex position, the subpixel subroutine also modifies the scan conversion of lines. Specifically, non-subpixel-positioned lines are drawn closed, meaning that connected line segments draw the pixel at their shared vertex, while subpixel positioned lines are drawn half open, meaning that connected lines segments share no pixels. (Smooth lines are always drawn half open, regardless of the state of the subpixel subroutine.)

Subpixel-positioned lines produce better results when you use the logicop or blendfunction subroutines, but will produce different, possibly undesirable results in 2-D applications where the endpoints of lines have been carefully placed.

For example, using the standard 2-D projection:

ortho2(left-0.5,right+0.5,bottom-0.5,top+0.5);
viewport(left,right,bottom,top);

Subpixel-positioned lines match non-subpixel-positioned lines pixel for pixel, except that they omit either the right-most or top-most pixel. Thus, the non-subpixel-positioned line drawn from (0,0) to (0,2) fills pixels (0,0), (0,1), and (0,2), while the subpixel-positioned line drawn between the same coordinates fills only pixels (0,0) and (0,1).

Parameter

bool Either True or False.
False = forces screen vertices to the centers of pixels (default).
True = positions screen vertices exactly.

Implementation Specifics

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

On the High-Performance 3-D Graphics Processor polygons are always subpixel positioned, regardless of the value of the subpixel subroutine. Subpixel-positioned nonsmooth lines are not implemented.

On the Supergraphics Processor, lines and polygons are never subpixel-positioned, regardless of the value of the subpixel subroutine. Vertices are always snapped to the center of a pixel before rasterization begins.

The POWER Gt4 and POWER Gt4x adapters do not support subpixel positioning.

On the POWER GXT1000 adapter, subpixel positioning is always on.

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 lines with the linesmooth subroutine.

Specifying antialiasing of points with the pntsmooth subroutine.

Smoothing Jagged Lines with Antialiasing, Understanding the Hardware Used by GL, Configuring the Frame Buffer.


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