index

Varkon Interactive users manual

# Colors, materials and light

When created, each single entity in Varkon gets an individual PEN number ranging from 0 to 255. You can set the currently active PEN number with the PEN button in the middle section of the menu window and you can edit the pen of a single entity in the edit menu. Varkon uses the PEN number to display an entity with a specific color or OpenGL material.

Note that the color or material specification of an entity is not saved in the module that creates the entity, only the PEN number. If you save a job and load it again, your entities will get the same colors and materials but if you use the module in another job the entities will get the colors and materials defined with that job.

## Colors

The Varkon ini-file by default defines the following 12 colors:

PEN | Color | Note
--- | --- | ---
0 | White | Default background color
1 | Black | Default PEN number
2 | Light red | Also used for active coordinate system
3 | Light green |
4 | Light blue |
5 | Dark red |
6 | Dark green |
7 | Dark blue |
8 | Brown |
9 | Yellow |
10 | Orange |
11 | Gray |

You can assign your own colors with the color dialog in `menu/view/colors`. Colors are specified as RGB (Red, Green, Blue) value triplets in the range of 0 to 255. You can also define a color with the cre_color() procedure in MBS.

## Materials

A material is a full OpenGL material specification including the RGB values for ambient, diffuse, specular and emitted light and also the shininess. To read more about OpenGL materials, see the cre_material() procedure in the MBS programmers manual.

Materials can only be displayed in OpenGL windows. In X11 windows materials will be displayed using the ambient RGB color values of the material.

## Light

Light in Varkon is equal to OpenGL light sources. When an OpenGL window is opened Varkon automatically creates a light source located at infinite distance along the positive Z-axis shining in the direction of the negative Z-axis (BASIC coordinate system). To create additional light sources (including spotlights) or to edit the default light, see the cre_light() procedure in the MBS programmers manual. You can create and turn on up to a maximum of 8 light sources at the same time.

Note that although OpenGL supports colored light, Varkon light sources are always white. Once defined, use `menu/view/lights` to set the intensity of a light source or to list basic light source data. You can also set the transformation behaviour of a light source. By default, light sources are static. If you switch to follow_model, the light source will follow the model if you pan, scale or rotate it interactively.

Note also that Varkon does not save your light sources when you exit your job. When you load an old job Varkon creates the default light automatically but if you have created your own light sources in MBS, run your module to update their status.

Varkon version 1.19C svn# 120