logo

X3DToolKit examples

home_link
download_link
examples_link
manual_link
reference_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. To compile the examples, please refer to the download page and follow the link to your platform. The step-by-step marked examples mean that important portions of code are explained.

qglviewer means that you need QGLViewer to run the example.

1. Load and display a scene

1.1. Load and display the structure of a scene (step-by-step)

Concepts: Loading an X3D file and using a predefined processor.
Applications: Using provided functionalities on scene graphs.
See graphTester.

1.2. Load and display a scene in OpenGL 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

2.1. Create a simple processor (step-by-step)

Concepts: Reading an X3D scene graph by applying the same process for each node.
Applications: Reading and displaying informations relative to the scene in text form.
See simpleNodeCounter.

2.2. Create a processor with two component visitors

Concepts: Reading an X3D scene graph by specializing the process for different nodes.
Applications: Reading and displaying informations relative to the scene in text form.
See nodeCounter.

2.3. Create a processor acting on the GL scene graph qt

Concepts: Reading the content of a GL 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.

2.4. 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.

3. Create a new node

3.1. 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.

3.2. 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.

3.3. Create a new parent node and a new type (step-by-step)

Concepts: Extending the X3D language by adding an X3DNode node that has children, and has an attribute of a new type.
Applications: Adding subgraphs of your own to the default scene graphs.
See infoReader.

3.4. 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.

4. Using the MESH scene graph

4.1. creating and removing faces (step-by-step)

Concepts: Using the two main nodes of the MESH scene graph which manage vertices, edges and faces.
Applications: Write algorithms modifying the mesh structure.
See meshCreation.

4.2. 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.

4.3. 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 mySimplifiedMeshViewer.

4.4. 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.

4.5. 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.

4.6. 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.

4.7. 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.

5. Miscellaneous

5.1. 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.

5.2. Use the routes

Concepts: Using the X3DTK::X3DRoute class to enable the route mechanism.
Applications: Dynamic behaviour specified in the X3D file.
See routeTester.