![]() |
VR-Vantage API Documentation
|
This example shows how to create multiple windows and channels. This application demonstrates the use of multiple windows with multiple channels each rendering the same scene, however each channel renders the scene differently.
A VR-Vantage application displays one or more windows; floating, embedded or full-screen. Each window can be divided into one or more channels. Each channel displays a view into the scene being rendered. To get the view, each channel has one observer in the scene rendering to the viewport the channel defines in the parent window.
Channels can share observers to display the same view within the scene. However to render different views into the same scene, different observer instances per channel are required. For this example to demonstrate how to render different models in each channel, multiple channels are created, each with its own observer-mode configuration. When creating an observer for a channel, the observer mode describes how the observer is to render the scene to the channel; such as 3D or 2D. Among other attributes defined by the observer-mode is the model-set to be rendered. A model-set is an identifier given to branches of the scene-graph that define which channel to render in. Each channel is configured with an observer-mode and the observer-mode defines which model-set renders in the channel.
When models are added into the scene, they are generally added to a scene-object which manages the model for the scene. The scene-object inserts the geometry to the scene-graph and positions the model in the scene. It is the scene-object that defines the model-set for the model. When a channel is rendering the scene-objects in the scene, the channel's observer will cull-out scene-objects that do not have a matching model-set for the channel. For example, if a channel is configured with the '3D' observer-mode, the channel will only render scene-objects with model-set zero. Scene-objects with other model-sets will not be rendered within that channel.
The observer-mode to model-set mapping is defined automatically when the VR-Vantage application is configured during initialization. At start-up and initialization, the application reads configuration files, one of which associate the observer-modes with the model-set identifiers to be used. To create custom observer-mode to model-set mappings, a custom configuration file can be used. This application uses a default configuration for the VR-Vantage XR application. The default observer configuration is located in a file named 'default_ObserverModes.omcx' located in the '.../appData/settings/vantageXR' directory.
The two important steps to rendering different scene-objects in different channels are:
This example uses three helper functions to configure the display into multiple windows with multiple channels, each with a different observer-mode.
The helper function to create the channels first creates an observer configuration with a unique observer name.
The observer-mode is defined in the observer-configuration, then the configuration is registered with the input driver found in the display engine's drive-manager.
The mode is a string matching one of the default observer-modes read in at application configuration time. The channel configuration is then created with its own unique channel name
The channel's viewport is defined and it is given the name of the observer configuration.
The helper function to create the windows first creates a window configuration with a unique window name.
Then the type of window, size and position are set in the window's configuration.
For each channel that the window displays, the window configuration is given a channel configuration by calling the helper function for channels.
The helper function to create the display configuration just creates a configuration and for each window displayed, is given a window configuration by calling the helper function for windows.
This example uses three helper functions to load the geometry files into scene-objects, each for a different model-set.
The helper function to register the model definitions takes the name of a model geometry file, creates a definition with a unique name and registers the definition with the display engine.
The helper function to load a model into the scene creates a scene-object with a unique id, assigns a model-set to the scene-object, and adds a model to the scene-object. The model is created with a previously registered model-definition.
When the model is added to the scene-object, the model is loaded from disk using the model-configuration.
The helper function to load the scene just iterates over a list of filenames for models, registering their definitions and generating scene-objects for each.
The main application for this example is created with the default configuration for a VR-Vantage XR application.
When the application is initialized, it creates a default display layout.This application creates a custom display layout with multiple windows and overwrites the initialized default
It is important to note that the custom display must be created and realized after the default application initialization. If the custom display were created first, the act of initializing would overwrite the custom display with the default. After the custom display is created the scene is loaded and the application is run.
VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
This example is an application. You can run it by running ./bin/exampleMultipleChannels.exe (on Windows) or ./bin/exampleMultipleChannels (on Linux). For more information about running examples, please see Running Applications and Examples.
This example shows how to create a multiple windows and channels. This application demonstrates the use of multiple windows with multiple channels each rendering the same scene, however each channel renders the scene differently.
A VR-Vantage application displays one or more windows; floating, embedded or full-screen. Each window can be divided into one or more channels. Each channel displays a view into the scene being rendered. To get the view, each channel has one observer in the scene rendering to the viewport the channel defines in the parent window.
Channels can share observers to display the same view within the scene. However to render different views into the same scene, different observer instances per channel are required. For this example to demonstrate how to render different models in each channel, multiple channels are created, each with its own observer-mode configuration. When creating an observer for a channel, the observer mode describes how the observer is to render the scene to the channel; such as 3D or 2D. Among other attributes defined by the observer-mode is the model-set to be rendered. A model-set is an identifier given to branches of the scene-graph that define which channel to render in. Each channel is configured with an observer-mode and the observer-mode defines which model-set renders in the channel.
When models are added into the scene, they are generally added to a scene-object which manages the model for the scene. The scene-object inserts the geometry to the scene-graph and positions the model in the scene. It is the scene-object that defines the model-set for the model. When a channel is rendering the scene-objects in the scene, the channel's observer will cull-out scene-objects that do not have a matching model-set for the channel. For example, if a channel is configured with the '3D' observer-mode, the channel will only render scene-objects with model-set zero. Scene-objects with other model-sets will not be rendered within that channel.
The observer-mode to model-set mapping is defined automatically when the VR-Vantage application is configured during initialization. At start-up and initialization, the application reads configuration files, one of which associate the observer-modes with the model-set identifiers to be used. To create custom observer-mode to model-set mappings, a custom configuration file can be used. This application uses a default configuration for the VR-Vantage XR application. The default observer configuration is located in a file named 'default_ObserverModes.omcx' located in the '.../appData/settings/vantageXR' directory.
The two important steps to rendering different scene-objects in different channels are:
This example uses three helper functions to configure the display into multiple windows with multiple channels, each with a different observer-mode.
The helper function to create the channels first creates an observer configuration with a unique observer name.
The observer-mode is defined in the observer-configuration, then the configuration is registered with the input driver found in the display engine's drive-manager.
The mode is a string matching one of the default observer-modes read in at application configuration time. The channel configuration is then created with its own unique channel name
The channel's viewport is defined and it is given the name of the observer configuration.
The helper function to create the windows first creates a window configuration with a unique window name.
Then the type of window, size and position are set in the window's configuration.
For each channel that the window displays, the window configuration is given a channel configuration by calling the helper function for channels.
The helper function to create the display configuration just creates a configuration and for each window displayed, is given a window configuration by calling the helper function for windows.
This example uses three helper functions to load the geometry files into scene-objects, each for a different model-set.
The helper function to register the model definitions takes the name of a model geometry file, creates a definition with a unique name and registers the definition with the display engine.
The helper function to load a model into the scene creates a scene-object with a unique id, assigns a model-set to the scene-object, and adds a model to the scene-object. The model is created with a previously registered model-definition.
When the model is added to the scene-object, the model is loaded from disk using the model-configuration.
The helper function to load the scene just iterates over a list of filenames for models, registering their definitions and generating scene-objects for each.
The main application for this example is created with the default configuration for a VR-Vantage XR application.
When the application is initialized, it creates a default display layout.This application creates a custom display layout with multiple windows and overwrites the initialized default
It is important to note that the custom display must be created and realized after the default application initialization. If the custom display were created first, the act of initializing would overwrite the custom display with the default. After the custom display is created the scene is loaded and the application is run.
VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
This example is an application. You can run it by running ./bin/exampleMultipleChannels.exe (on Windows) or ./bin/exampleMultipleChannels (on Linux). For more information about running examples, please see Running Applications and Examples.