This example shows how to create a display configuration.
You can create a display configuration (with any number of windows and channels) programmatically and then have it created by a display engine. Display configurations must have unique names. The display engine will prevent you from realizing configurations with duplicate names.
- Create a channel configuration giving it a unique name of "Channel 1" like this:
std::string cName = DtChannelConfiguration::DefaultChannelString;
cName += " 1";
DtChannelConfiguration cc1(cName);
- Create a window configuration and add the channel configuration to it:
std::string wName = DtWindowConfiguration::DefaultWindowString;
wName += " 1";
DtWindowConfiguration wc1(wName);
wc1.setWindowType(DtWindowConfiguration::Window);
wc1.setPosition(100,100);
wc1.channelConfigurations().add(cc1);
- Add the window configuration to a display configuration:
DtDisplayConfiguration dc;
std::string deName = "My Display Configuration";
dc.setName(deName);
dc.windowConfigurations().add(wc1);
dc.windowConfigurations().add(wc2);
Once you have a display configuration, you must add it to the master display engine and tell the master display engine which display engine to create that configuration on. To try to add the configuration to the master display engine, do the following:
if(vrvApp.de().addDisplayConfiguration(dc))
If you are successful, tell it to create that configuration on a display engine. Here, we create it on the master display engine:
std::string displayName = vrvApp.de().igCommunicator().name();
vrvApp.de().realizeDisplayConfiguration(displayName, dc.name());
This causes the window and channel to be created on the master display engine.
Note: When you create a configuration, any previously created configurations are destroyed.
Building the Example
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.
Running the Example
This example is an application. You can run it by running ./bin/exampleConfiguration.exe (on Windows) or ./bin/exampleConfiguration (on Linux). For more information about running examples, please see Running Applications and Examples.
Example Source Files
exampleConfiguration.cxx
#include <iostream>
using namespace makVrv;
{
cName += " 1";
wName += " 1";
wc1.setPosition(100,100);
wc1.channelConfigurations().add(cc1);
cName += " 2";
wName += " 2";
wc2.setPosition(500,100);
wc2.channelConfigurations().add(cc2);
std::string deName = "My Display Configuration";
return dc;
}
int main(int argc,char** argv)
{
{
}
else
{
std::cout <<
"Couldn't add display configuration: " << dc.
name() << std::endl;
}
}