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

writeRGB Subroutine


Paints a row of pixels on the screen in RGB mode.


Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void writeRGB
(Int16 number, 
RGBvalue red[ ], RGBvalue green[ ], RGBvalue blue[ ])


SUBROUTINE WRITER(number, red, green, blue)
INTEGER*4 number
CHARACTER*(*) red, green, blue
Note: For FORTRAN users, this subroutine accepts long integer parameters (INTEGER*4) when invoked from a FORTRAN program, although it accepts short integers when invoked from a C program. The C and FORTRAN syntax shown here reflect this difference.


The writeRGB subroutine paints a row of pixels on the screen in RGB mode.The system reads elements from the arrays specified in the red, green, and blue parameters and writes a pixel of the appropriate color for each.

The starting location for the row of pixels is the current character position. The system updates the current character position to one pixel to the right of the last painted pixel. The system paints pixels from left to right and clips to the current screenmask. The current character position becomes undefined if the new position is outside the viewport.

The writeRGB subroutine does not automatically wrap from one line to the next. It supplies a 24-bit RGB value (8 bits for each color) for each pixel. This value is written directly into the bitplanes.

Note: When there are only 12 color bitplanes available, the lower 4 bits of each color are ignored.

The rectwrite subroutine provides significantly better performance for pixel block transfers. Even when only one row of pixels needs to be read, use the rectwrite subroutine.

  1. This subroutine is available only in RGB mode.
  2. This subroutine cannot be used to add to a display list.
  3. The use of this subroutine is deprecated. Do not use the writeRGB subroutine in new development.


number Specifies the number of pixels to paint.
red Specifies an array containing red values for each pixel to paint.
green Specifies an array containing green values for pixel to paint.
blue Specifies an array containing blue values for each pixel to paint.

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

Returning the value of specific pixels in RGB mode with the readRGB subroutine.

Copying a rectangle of pixels with an optional zoom with the rectcopy subroutine.

Reading a rectangular array of pixels into host memory with the rectread subroutine.

Drawing a rectangular array of pixels into the frame buffer with the rectwrite subroutine.

Painting a row of pixels on the screen in color map mode with the writepixels subroutine.

AIX Graphics Library Overview, Reading and Writing Pixels, Using Viewports and Screenmasks, and Working in Color Map and RGB Modes.

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