From JReality Wiki
Jump to: navigation, search

Use a transformation

Source file: Intro08

JavaDoc: Transformation

Run as Java webstart

This example shows how to display a ready-made cube from the Primitives class. It also includes the code necessary to stretch the cube using a scaling transformation. The method createFullSceneGraphComponent() is a utility method which creates a SceneGraphComponent which contains an appearance and transformation. Notice also the use of the MatrixBuilder class; it contains a variety of convenience methods for creating and concatenating 4x4 matrices together.

    SceneGraphComponent myscene = SceneGraphUtility.createFullSceneGraphComponent("myscene");

This code should result in an image like this one from the User Tutorial:

Scaled cube

Previous: Intro07 Developer Tutorial: Contents Next: Developer Tutorial