OpenGL is an industry standard in 3D display programming. OpenGL must be used for any cross-platform 3D display software. However, OpenGL is not object-oriented, and it is difficult to use OOP for programming. This results in low efficiency in writing OpenGL programs. Therefore, the Open Inventor library came into being.
The Open Inventor library uses OOP technology to perfectly encapsulate OpenGL. If you use languages that support OOP design patterns (such as C ++ and Java), we strongly recommend that you put down the OpenGL reference manual, invest in the Open Inventor library.
Open Inventor is an open source software library developed by SGI, the parent company of OpenGL technology. Because it is open-source, many companies are adding/modifying code for this library, which makes the Open Inventor library grow fast. I have to mention the TGS Company, which focuses on developing Open Inventor libraries, so we use the most common Open Inventor libraries of the TGS version.
The most basic concept in Open Inventor is class ). These classes can be divided into two major functional parts.
- Storage Class: class for storing three-dimensional information, such as nodes, groups, and paths;
- Category: aims to implement certain action behaviors, such as styling changes, camera changes, color changes, and scenario traversal.
To master Open Inventor, you should start with three basic types: node, group, and path ).
A node is a space point in a 3D scenario. The most important thing to note is that the property of the node class is extended to a field in the Open Inventor library). In Oop, a variable of a class is its attribute. In the Open Inventor library, attributes on the node can also be flexibly controlled by joint assignment, so it is beyond the class attribute concept of general OOP programming. Understanding and mastering the "Domain" is the key to getting familiar with node classes.
A group is a combination of nodes, while a path concatenates different nodes or groups in a certain form to facilitate the transmission of a worker class.
In the Open Inventor library, Node, Group, and Path are the basic concepts, and the most basic 3D spatial information storage model is constructed; on the basic model, Open Inventor provides the concept of a B-Spline-based. As an advanced concept of the Open Inventor library, a curve surface consists of control vertices, node sequences, and order. Generally, commercial 3D software supports the use of green surface. It provides the "plasticine" three-dimensional surface control capability, but for basic programming, it is really difficult and meaningless to use a place where you are just a beginner in the Open Inventor library. If the software you write is a course assignment or a lab on a degree Scientific Research Project, "stay away from a place where you can use a place where you are, cherish time "is my advice for you.
In addition to the class used to store 3D spatial information, Open Inventor also provides many classification classes. By attaching these 2D classes to the above storage class, you can achieve many 3D display effects, such as rendering, moving the angle of view, and changing the texture. Because the Open Inventor library is object-oriented, it has a good Event Response Function. You can program events by responding to events. For example, when a node is moved, an action can greatly improve the efficiency of 3D programming. This is the least function of OpenGL, it is also the most attractive place for the Open Inventor library.
To facilitate event programming, the Open Inventor Library also creatively proposes two new concepts:
- SENSOR: Used to listen for data changes in scenarios and adopt unified Event Callback functions;
- Engine: automates certain actions to achieve consistent action operations;
"Sensor" and "engine" are great concepts that greatly facilitate 3D animation programming. Look at the engine name provided by the Open Inventor library, such as the timer, single trigger, timer, gate engine, and arithmetic engine. Oh, 3D animation programming will be "dream" rather than "nightmare.
References
- Mercury computer systems, open inventror from TGS User Guide
- Yan fengxin and others, Open Inventor Program Design from entry to proficient, Beijing: Tsinghua University Press, 2007