OpenGL and RenderMan, Color
[ contents ]
OpenGL and RenderMan, Color

RenderMan

One uses the RiColor() command to select a current color. It is generally called just before the geometry is drawn.

OpenGL

In RGBA mode, one uses the glColor*() command to select a current color. It is generally called just before the geometry is drawn.

RiColor(color)

RiColor() replaces the current surface color in the graphics environment with the new color color. The current color is an atribute of the graphics environment, saved and restored like any other. color is of type RtColor which is an array of three floating points for r, g and b respectively.

RtColor green = {0.0, 1.0, 0.0};

RiColor(green);

glColor*(r, g, b)

glColor*() sets the current red, green, blue and alpha values. This command can have three suffixes. The first suffix is either a 3 or 4, to indicate whether you supply an alpha value. The second suffixes indicates the data type for r, g and b. The third suffix is an optional v, which indicates that the argumentis a pointer to an array of values of the given data type.

GLfloat green[3] = {0.0, 1.0, 0.0};

glColor3fv(green);
glColor3f(1.0, 0.0, 0.5);