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

pick Subroutine


Places the system in picking mode.


Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void pick(Int16 buffer [ ], Int32 bufferlen)


SUBROUTINE PICK(buffer, bufferlen)
INTEGER*4 bufferlen
INTEGER*2 buffer(bufferlen)


The pick subroutine places the system in picking mode. When the system is in picking mode, the extent of all subsequent drawing primitives are compared to a picking volume. The picking volume is defined by the location of the cursor when the pick subroutine was called and by the picking volume size.

If a drawing primitive overlaps or intrudes upon the picking volume, a hit has occurred. The hit is recorded only if the name stack has been touched since the last hit. Any of the subroutines loadname, pushname, or popname touch the name stack. The first hit after picking begins is always recorded.

A hit is recorded by placing the depth of the name stack into the next vacant slot in the buffer, followed by the entire contents of the name stack. The bottom of the name stack is transferred to the buffer first, followed by the second from the bottom entry of the name stack, and so forth. In other words, the data from bottom to top is mapped from left to right.

With one exception, all drawing routines cause hits, including clear, points, lines, polygons, arcs, circles, curves, patches, and NURBS. The charstr subroutine does not cause a hit, although cmov and cmov2 do cause hits.

Picking does not work if you issue a new viewport in picking mode.

Nothing is drawn to the screen when the system is in picking mode. Instead, drawing commands are piped to the picking mechanism and used to determine pick or select region hits. On most systems, nothing is actually placed in the pick buffer until the endpick subroutine is called.

Note: This subroutine cannot be used to add to a display list.


buffer Specifies the array to use for storing names.
bufferlen Specifies the length of the array specified in the buffer parameter.


The example C language program pick1.c calls the pick subroutine to pick objects when the left mouse button is pressed.

Implementation Specifics

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


/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

Turning off picking mode with the endpick subroutine.

Putting the system in selecting mode with the gselect subroutine.

Initializing the name stack with the initnames subroutine.

Loading the name on top of the name stack with the loadname subroutine.

Setting the dimensions of the picking region with the picksize subroutine.

Popping a name off the name stack with the popname subroutine.

Pushing a new name onto the name stack with the pushname subroutine.

AIX Graphics Library Overview, Picking and Selecting Overview, and Using Viewports and Screenmasks.

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