Chapter 2. Creating a Node

This chapter explains how you can create new subclasses of SoNode SoNode SoNode . It discusses enabling elements in the state, constructing a node, and implementing actions for it. Chapter 1 provides important background material on these concepts, and this chapter assumes you are familiar with the material presented there.

The first part of this chapter offers an overview of the steps required to create a new node. When necessary, additional sections explain key concepts in further detail and list the relevant macros. Next, the chapter examples show how to create three new node classes:

  • A property node class called Glow

  • A shape node class called Pyramid

  • A group node class called Alternate

Sections at the end of the chapter discuss the following:

  • Using new node classes

  • Creating abstract classes

  • The copy() method

  • The affectsState() method

  • Creating nodes that cannot be cached

  • Creating an alternate representation for a new node class