English فارسی Suomi
Français Nederlands Translate

Fluxus

Fluxus: RenderHints

A poly sphere with normals, wireframe and solid hints, and line width set to 4 pixels

Render Hints

We've already come across some render hints, but to explain them properly, they are miscellaneous options that can change the way a primitive is rendered. These options are called hints, as for some types of primitives they may not apply, or may do different things. They are useful for debugging, and sometimes just for fun.

(hint-none)

This is a very important render hint – it clears all other hints. By default only one is set – hint-solid. If you want to turn this off, and just render a cube in wire frame (for instance) you'd need to do this:

(hint-none)
(hint-wire)
(build-cube)

For a full list of the render hints, see the function reference section. You can do some pretty crazy things, for instance:

(clear)
(light-diffuse 0 (vector 0 0 0))
(define l (make-light 'point 'free))
(light-position l (vector 10 50 50))
(light-diffuse l (vector 1 1 1))
(shadow-light l)

(with-state
    (hint-none)
    (hint-wire)
    (hint-normal)
    (translate (vector 0 2 0))
    (hint-cast-shadow)
    (build-torus 0.1 1 10 10))

(with-state
    (rotate (vector 90 0 0))
    (scale 10)
    (build-plane))

Draws the torus from the shadowing example but is rendered in wireframe, displaying it's normals as well as casting shadows. It's become something of a fashion to find ways of using normals rendering creatively in fluxus!


EDIT