### 5.4.1 Choosing a Color Mode

The EZ graphics library supports both RGB mode and Colormap (index) mode. The color mode is binded to 3DCanvases, i.e., each 3DCanvas may choose either of the two color modes. But realistically, the two color modes cannot be used simultaneously since EZwgl uses a single physical colormap.

`void EZ_RGBMode(void)`

This function sets the display mode to RGB mode. On 8bit displays, EZwgl uses dithering to simulate a 24 bit RGB Mode.

In RGB mode, colors are referenced directly from their RGB intensities. There are two pairs of functions for setting the current color in RGB mode.

`void EZ_Color3f(float r, float g, float b)`

`void EZ_Color3fv(float rgb[3])`

`void EZ_Color3i(int r, int g, int b)`

`void EZ_Color3iv(int rgb[3])`

All these routines set the current RGB color. In the ``f`' version, RGB intensities are in the range [0.0, 1.0] while in the ``i`' version, intensities are in the range [0, 255].

`void EZ_ColorMapMode(void)`

This function sets the display mode to index mode. Care must be taken in index mode since we only have a very limited number of colors.

In ColorMap mode, colors are refered through a lookup table (internal color map). Entries of this table can be set/modified by calling the function

`void EZ_MapColor(int idx, int r, int g, int b)`

To set the current color in ColorMap mode, use

`void EZ_Index(int idx)`

`void EZ_Indexf(float fidx)`

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`