About This Book

The Inventor Mentor introduces graphics programmers and application developers to Open Inventor, an object-oriented 3D toolkit. Open Inventor is a library of objects and methods used for interactive 3D graphics. Although it is written in C++, Open Inventor also includes C bindings.

For the sake of brevity, the examples included in this book are in C++. All C++ examples, as well as equivalent examples written in C, are available on-line. If you are new to the C++ language, see Appendix A, “An Introduction to Object-Oriented Programming for C Programmers,” to help you understand the references to classes, subclasses, and other object-oriented concepts used throughout this book. If you are using the C application programming interface, also see Appendix B, “An Introduction to the C API.”

What This Book Contains

This book describes how to write applications using the Open Inventor toolkit. The Inventor Toolmaker, a companion book for the advanced programmer, describes how to create new Inventor classes and how to customize existing classes.

The Inventor Mentor contains the following chapters:

There are three appendices:

How to Use This Book

It's unrealistic to expect anyone to read a lengthy programmer's guide from start to finish. After you read a few basic chapters, you can skim others and skip around, depending on your particular needs and goals. Here are a few suggested paths for making your way through this book.

For a basic understanding of how to create nodes and connect them into scene graphs, read Chapters 1 through 5. Then read Chapter 9, “Applying Actions,” and Chapter 10, “Handling Events and Selection.”

If you are mainly interested in reading files into the Inventor database, read Chapters 1 and 2 for an overview of Inventor, and then jump to Chapter 11, “File Format.”

If you are an experienced OpenGL programmer, Chapters 1, 2, 10, and 17, “Using Inventor with OpenGL,” are important chapters to begin with. Again, for a basic understanding of building a scene graph, you also need to read Chapters 3 through 5 and Chapter 9.

Chapter 15, “Draggers and Manipulators,” and Chapter 16, “Inventor Component Library,” describe the programming aspects of Inventor that have an associated user interface. The user interface for individual components is described in the on-line HELP cards provided for each class.

Once you understand the basic material presented in Chapters 1 through 5, you can skip to Chapter 13, “Engines,” and Chapter 14, “Node Kits.” Engines, like nodes, are basic building blocks in the scene graph. They allow you to animate parts of the scene graph and to incorporate additional behavior into scene graph objects. If you are creating scene graphs, node kits offer many shortcuts.

What You Should Know
Before Reading This Book

This book assumes you are familiar with basic concepts of 3D graphics programming. For example, it assumes you have a reasonable understanding of the following terms: lighting, rendering, vertex, polygon, light source, picking, matrix, OpenGL, pixel, surface normal. If these terms are new to you, consult one or two of the sources listed in “Suggestions for Further Reading,” later in this introduction.

In addition, this book assumes you have some familiarity with concepts related to object-oriented programming. See “Suggestions for Further Reading” as well as Appendices A and B for good background information.

Conventions Used in This Book

This book uses boldface text font for all Inventor classes, methods, and field names: SoNode, SoMaterial, getValue(), setValue(), ambientColor, and center. Parentheses indicate methods. Code examples are in Courier font.

Tips

Several headings are used in paragrahs to highlight different kinds of text. Programming tips are marked with their own heading Tip:.

Advanced Information

Information that is considered advanced, and could be skipped during your first reading, is marked with their own heading (Advanced). This heading can apply to a single paragraph or to an entire section or chapter.

Key to Scene Graph Diagrams

Figure In-1 shows the symbols used in the scene graph diagrams that appear throughout this guide.

Suggestions for Further Reading

For a general introduction to computer graphics, see the following:

  • Foley, J.D., A. van Dam, S. Feiner, and J.F. Hughes, Computer Graphics Principles and Practice, 2e. Reading, Mass.: Addison-Wesley, 1990.

  • Neider, Jackie, Tom Davis, Mason Woo, OpenGL Programming Guide. Reading, Mass.: Addison-Wesley, 1993.

  • Newman, W., and R. Sproull, Principles of Interactive Computer Graphics, 2e. New York: McGraw-Hill, 1979.

For an introduction to the C++ language, see the following:

  • Lippman, Stanley B., A C++ Primer, 2e. Reading, Mass.:Addison-Wesley, 1991.

  • Shapiro, Jonathan, A C++ Toolkit. Englewood Cliffs, N.J.: Prentice-Hall, Inc., 1991.

For an introduction to object-oriented programming, see

  • Meyer, Bertrand, Object-Oriented Software Construction. London: Prentice Hall International, 1988.

    Figure 1. Scene Graph Symbols


Acknowledgments

As a student of the Open Inventor toolkit, I am deeply indebted to the original Inventor mentors, who contributed so much to the development and content of this book: Rikk Carey, Gavin Bell, Alain Dumesny, Dave Immel, Paul Isaacs, Howard Look, David Mott, Paul Strauss, and Helga Thorvaldsdóttir. Even under the pressures of tight deadlines and numerous competing responsibilities, the members of the Inventor team consistently met my demands: they answered all questions, reviewed numerous drafts, and created the code examples that are the core of this book. Rikk Carey provided dynamic leadership for the Open Inventor project, rigorously questioning and challenging each decision. Paul Strauss, one of the chief architects of Inventor, probably read the most drafts and definitely added the most red (and green) ink to those drafts. His insightful and literate reviews were invaluable to me. Additional eagle-eyed reviewers included Ronen Barzel, Sam Chen, Beth Fryer, and Kevin Goldsmith.

Putting all the pieces of the puzzle together—screen shots, line art, color plates, text, code examples—also required a large cast of people. Rikk Carey created the cover image. Catherine Madonia used Rikk's scene to create the black-and-white images for the part- and chapter-title pages. Paul Isaacs showed his creative genius—not to mention his ability to work under brutal deadlines—in creating the many models and scenes for the images shown in Figure In-2 through Figure In-22. I'm also grateful to Maria Mortati, who designed the color plate section and persuaded me to make massive edits to the figure captions. Catherine Madonia helped by creating conceptual images and by taking snapshots of the example programs. The many details of dealing with vendors, coordinating printer tests and schedules, and producing the book were ably handled by Laura Cooper and Lorrie Williams. Line art was drawn by Kay Maitz, Cheri Brown, Dan Young, Howard Look, and Lorrie Williams. Helga Thorvaldsdóttir paid special attention to the code examples: writing many of them, and revising and polishing to the bitter end.

Many thanks to Kirk Alexander, of the Interactive Computer Graphics Laboratory at Princeton University, who supplied numerous images and revisions to satisfy our requests precisely. The Out-of-Box Experience, an application originally designed for the Silicon Graphics Indy workstation, shown in Figure In-38 through Figure In-41, was created by Leo Blume, Mark Daly, Kevin Goldsmith, Howard Look, and Chee Yu of Silicon Graphics, and Brad de Graf, Shari Glusker, Jill Huchital, Karen Hughes, Peter Oppenheimer, Mark Swain, Drew Takahashi, and Phil Zucco of (Colossal) Pictures. The art gallery tour shown in Figure In-31 is the work of Gavin Bell, Mark Daly, Kevin Goldsmith, and Linda Roy, all of Silicon Graphics. Many of the models used in the cover scene were created by Acuris, Inc.

I'd also like to thank Jackie Neider, manager of Developer Publications in the Visual Magic Division of Silicon Graphics, and the other members of my department—Patricia Creek, Arthur Evans, Liz Deeth, Beth Fryer, Jed Hartman, Ken Jones, John Stearns, Eleanor Bassler, and Carol Geary—for their consistent support and encouragement during the course of this project (and for sharing the high-speed printer).

And, most important, thanks to my husband, Steve, and my sons, Jeff and Evan, for a warm dinner and cheerful conversation at the end of some very long days.