E.1. Scene APIs

The following example shows a complete MPEGlet[1] using the Scene API to invert the color of a shape node when the user clicks on it. In this example, SceneExampleMpeglet implements the MPEGlet interface, SceneListener interface, and the EventOutListener interface. Initially, the SceneManager object is obtained from the MpegjTerminal and the MPEGlet adds itself as the SceneListener. Then the MPEGlet retrieves a reference to the TouchSensorNode (defined with the name TOUCH) and registers itself to be notified when the user clicks on the TouchSensorNode. Finally, the MPEGlet inverts the color of the shape node (defined with the name “MATERIAL”) when the MPEGlet receives the touch event.

[1] MPEG-J applications are called MPEGlets. ...

Get MPEG-4 Book, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.