Chapter 6

Lights without sources

As lights are positional states in OpenGL, a light object attached to a node will always be affected by the node's local matrix. That is to say, the light will follow the node and work as a "headlight" of the moving vehicle. The osg::LightSource node can be used to fix the position of the light, with the setReferenceFrame() method. A fixed light can be treated as a "skylight" of the whole world.

Replacements of built-in uniforms

There are no standard ways to implement built-in uniforms. You could always use one or more of your own uniforms to emulate them, for example, use multiple vec4 variables (ambient, diffuse, specular, and so on) and float values (spot cut-off, attenuation) to deliver light parameters. The book ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.