logo

X3DToolKit examples

home_link
concepts_link
download_link
examples_link
developer_link
Here are some common development scenarii. These examples are ordered from the simplest to the most complicated. The links point to the doxygen documentation. Before trying the second example and the following, it is recommended to read the concepts page, as well as the following pages: To compile the examples, please refer to the download page and follow the link to your platform.

qt means that you need QGLViewer to run the example.

1. Load and display a scene qt

Concepts: Loading and drawing an X3D file by using the SimpleX3DGLScene class.
Applications: Integrating an X3D viewer in a 3D visualization application.
See X3DViewer.

2. Create a new processor qt

Concepts: Reading the content of a scene graph using a processor which contains the walking algorithm as well as the node visitor.
Applications: Reading, editing or displaying informations relative to the scene in text form or 3D form, reading and translating the data into your own structure, creating a translator from X3D to another file format.
See glNormalViewer.

3. Derive an existing processor

Concepts: Extending a processor to a new node, refining the initial behaviour of a processor.
Applications: Customizing an existing processor to reuse the code and refine it when the default behaviour is not specific enough.
See myMemReleaser.

4. Create a new node

a. Create a new simple child node qt

Concepts: Extending the X3D language by adding a X3DNode node to the X3D scene graph.
Applications: Adding your own informations to a scene graph and being able to save them to a file.
See icosahedronViewer.

b. Create by deriving an existing node qt

Concepts: Extending the X3D language by defining an X3DNode derived from an existing one.
Applications: Specializing the content of a node, by adding informations per vertex in the Coordinate node for example.
See newNodeViewer.

c. Create a new parent node

Concepts: Extending the X3D language by adding an X3DNode node that can have children, implying an extension of the walking algorithm.
Applications: Adding subgraphs of your own to the default scene graphs.
See infoReader.

d. Redefine a node in a new component

Concepts: Extending the X3D language by redefining an X3DNode node and integrating it in a new component.
Applications: Defining polymorphic node behaviour depending on the application.
See redefineNodeTester.

5. Animate a model qt

Concepts: Using the GL::IndexedFaceSet class to animate a scene.
Applications: Efficient access and modification of the existing structures.
See simpleAnimationViewer.

6. Using the MESH scene graph

a. Using the SimplifiedMeshScene

Concepts: Loading and using a simplified Mesh scene graph thanks to the SimplifiedMeshScene class.
Applications: Use simplified version of the MESH scene graph with loss of information but easy-to-use..
See simplifiedMeshViewer.

b. Extending the SimplifiedMeshScene

Concepts: Loading and using an extended simplified Mesh scene graph by creating a new attribute for a Mesh entity.
Applications: Use a personal simplified version of the MESH scene graph with loss of information but easy-to-use.
See simplifiedMeshViewer.

b. Building your own structure from the MESH scene graph

Concepts: Reading and translating a Mesh scene graph into your own structure by using predefined DefaultMesh avoiding the definition of template classes.
Applications: Create an X3D loader for your applications that need topology informations.
See myStructureComputer.

d. Displaying and selecting the entities of the MESH scene graph qt

Concepts: Making requests to a MESH scene graph and using OpenGL to display the scene.
Applications: Using the Mesh scene graph as a component of your application.
See meshViewer.

e. Printing optional basic informations via templates

Concepts: Walking the MESH scene graph and making basic requests to the Mesh node, of which template data have been carefully chosen.
Applications: Reading the content of a scene by benefiting from the topology informations of a Mesh structure.
See meshTransformComputer.

f. Extending the MESH scene graph via templates

Concepts: Customizing the Mesh scene graph in order to fit precisely your needs. Creating your own Mesh data that extends the Mesh scene graph and read from the X3D scene graph. Saving them to the X3D scene graph.
Applications: Using a personalized version of the Mesh scene graph as a component of your application.
See meshExtension.