Viewer components are a set of helpful tools to implement a custom viewer. In a previous article, available here, we showed how it is possible to customize them with Dear ImGui.
Of course ViewerComponents allow more than just a graphical customization. In this article we will show how it is possible to use a mobile device to interact with the camera of a QMLRenderAreaOrbiter(C++)</sup.>.
Note: This simple example comes with a script to generate a solution to be loaded by Visual Studio under Windows. Some modifications have to be done if you want to test it on another platform supported by Open Inventor.
- First thing first, in order to be able to launch the demonstrator you will need a valid installation of Open Inventor 10.10 (at least) C++ for Windows - Visual Studio 2017 (please refer to Download Page). In the following document, the folder where Open Inventor 10.10 is installed will be referred as OIVHOME.
- Once Open Inventor 10.10 is installed on your computer, download the Demo Package from here. It is a zip archive with the following content
- setup-build.bat : a simple batch file which simplifies the generation of Visual Studio Solution
- README.txt: text file with general informations
- LICENSE.txt: the license attached to QrCode sources
- CMakeList.txt: the top CMakeLists used to generate the Visual Studio Solution
- RenderArea_RemoteControl: the folder containing sources for the example
- Open the file setup-build.bat with a text editor to set the value defining your configuration
- set the OIVHOME value to point to the folder where is installed Open Inventor 10.10 on your system
- set the Qt5HOME value to point to the folder where is installed you Qt5 (make sure inside this folder you can find a lib\cmake\Qt5 subfolder)
- Optionnal : this setup will generate a solution to be loaded with Visual Studio 2019. If you want to use another version of Visual Studio please take a look at line 23 (cmake call) and line 30 to change the path to your Visual Studio. Eventually if you did not download a Visual Studio 2017 version of Open Inventor, change the OIVARCH variable so it matches your configuration
When the script file matches your configuration simply double click on it. It will run cmake configuration, cmake generation and open the generated solution with Open Visual Studio 2019.
After having loaded the solution in Visual Studio, simply choose Debug or Release configuration. Note this is higly recommended to use Release to get better performances.
In order to be able to connect your smartphone to the application, you must ensure that the demo will be launched on a computer connected to a local network. If the network configuration is correct, get the IP address of the computer on this local network (type ipconfig in a command shell under windows for example) and report it as command line argument of the Visual Studio project. See picture below for more details.
Of course you will need to connect your mobile device on the same network (we recommend using Firefox to test this demo with your mobile device).
Then you can simply launch the project. Press A on the viewer to display a QR COde and scan it with your mobile device. The scanning application should offer to open directly the link. Proceed if your default web browser is Firefox. Otherwise copy/paste the scanned URL in the address bar of Firefox.
Once the mobile device is connected to the application the QR Code will disapppear and you should be able to manipulate the camera of the viewer from your mobile device (by touching the screen or moving the phone)
The video below shows the demo in action from the QR Code scan to the manipulation of the camera using the mobile device.
Of course the interactions between the phone and the viewer could easily be extended to any actions: long tap on the device to open a contextual menu on the phone, colormap selection/edition on the phone etc. and
An easy and very convienient way to ease a presentation or to allow remote control and share interactivity.