Difference between revisions of "CalVR"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
Line 1: Line 1:
 +
==Overview==
  
 +
This wiki page was created to give programmers an overview of how to use IVL's virtual reality visualization framework CalVR. Special emphasis is given to those programmers who already know how to write code for COVISE.
  
== Overview ==
+
==CalVR Specs==
  
This page talks about adding a new plugin for CalVR, starting from building OSG and CalVR from source. You need [http://www.cmake.org/cmake/resources/software.html cmake] to build OSG, CalVR and your plugins.
+
# Operating system: [http://www.centos.org/ CentOS 5] Linux
 +
# Programming language: C++
 +
# Graphics API: [http://www.openscenegraph.org OpenSceneGraph]
 +
# Build system: [http://www.cmake.org/cmake/resources/software.html CMake]
 +
# Tracking APIs supported: [http://www.cs.unc.edu/Research/vrpn/ VRPN], [http://www.mechdyne.com/trackd.aspx TrackD]
 +
# PC cluster support
 +
# Support for multi-screen virtual reality systems
  
== Building OSG ==
+
==Building OSG==
 
+
 
+
Developer release of OSG can be found [http://www.openscenegraph.org/projects/osg/wiki/Downloads/DeveloperReleases here]
+
 
+
Assume the unpacked directory is osg/, and cmake/bin/ is in the path, in osg/ run ccmake:
+
ccmake .
+
It turns into a terminal interface of cmake config for osg.
+
  
 +
The developer release of OSG can be found [http://www.openscenegraph.org/projects/osg/wiki/Downloads/DeveloperReleases here].
 +
Go to main OSG directory and type <tt>ccmake .</tt>
 
In CMAKE_BUILD_TYPE, press Enter to edit the field, type in one of the options that with debug information: RelWithDebInfo
 
In CMAKE_BUILD_TYPE, press Enter to edit the field, type in one of the options that with debug information: RelWithDebInfo
 +
Press 'c' to configure, press 'g' to generate. and 'q' to quit. Now type <tt>make</tt> to build. Go get coffee.
  
press 'c' to configure, press 'g' to generate. and 'q' to quit. Now back to osg/, just type make to build. It takes quite a while to build.
+
==Building CalVR==
 
+
== Building CalVR ==
+
 
+
 
+
Make sure CalVR Dependencies(OSG, MXML, GLEW) are in the environment variables. If not, set them in .cshrc, for example, adding OSG in the environment, add this line at the ned of .cshrc:
+
setenv OSG_HOME ~/osg/
+
  
 +
Make sure all CalVR Dependencies (OSG, Mini XML, GLEW) are specified by environment variables. If not, set them in the shell startup script (eg, .cshrc, .bash_profile).
  
Run cmake/bin/cmake-gui, let CalVR/ be both the source and binaries
+
Run cmake/bin/cmake-gui, let CalVR/ be both source and binaries.
  
click Configure, select Unix Makefile, and it should show a configuration list for CalVR
+
Click Configure, select Unix Makefile, and it should show a configuration list for CalVR.
  
 
Navigate to OSG-->OSG_LIBRARY, if it is NOTFOUND, you may need to point it to your osg/lib, this is an example input:
 
Navigate to OSG-->OSG_LIBRARY, if it is NOTFOUND, you may need to point it to your osg/lib, this is an example input:
 +
<pre>
 
  -L/home/hwang/CalVR/externs/osg/lib -losgFXrd -losgParticlerd -losgTextrd -losgSimrd -losgGArd -losgViewerrd -losgDBrd -losgShadowrd -losgUtilrd -lOpenThreadsrd -ldl
 
  -L/home/hwang/CalVR/externs/osg/lib -losgFXrd -losgParticlerd -losgTextrd -losgSimrd -losgGArd -losgViewerrd -losgDBrd -losgShadowrd -losgUtilrd -lOpenThreadsrd -ldl
 +
</pre>
  
 
Note that many -losg*rd inputs, where are different than the IVL OSG_LIBRARIES, with extra "rd" tails (release and debug). In some configurations the libraries may no have "rd" tailing.
 
Note that many -losg*rd inputs, where are different than the IVL OSG_LIBRARIES, with extra "rd" tails (release and debug). In some configurations the libraries may no have "rd" tailing.
Line 36: Line 37:
 
You may also turn on PLUGINS->PLUGINS_CALIT to build your plugin at the same time.
 
You may also turn on PLUGINS->PLUGINS_CALIT to build your plugin at the same time.
  
click Generate, when it is done, you may exit the gui.
+
Click Generate, when it is done, you may exit the GUI.
  
In CalVR folder, type make to build.
+
In the CalVR folder, type <tt>make</tt> to build.
  
 
==Runing CalVR==
 
==Runing CalVR==
Line 47: Line 48:
 
  setenv CALVR_HOME /home/hwang/CalVR/
 
  setenv CALVR_HOME /home/hwang/CalVR/
  
The entrance program is in CalVR/bin/CalVR
+
The main CalVR executable is CalVR/bin/CalVR.
  
==Adding a plugin for CalVR==
+
==Adding a new Plugin for CalVR==
  
Take CalVR/plugins/calit2/ModelLoader as a start up example:  
+
Use CalVR/plugins/calit2/ModelLoader as a template:  
  
Make a new Copy of the ModelLoader folder, rename it to ExamplePlugin. Each directory hierarchy has files "CMakeLists.txt" and "cmake_install.cmake". In order for cmake to generate a make file for the new plugin, we need to add an entry to these cmake files in the parent directory, and modify the cmake files in the new plugin directory.
+
Make a copy of the ModelLoader folder, rename it to <YourPluginName>. Each source code directory has the files "CMakeLists.txt" and "cmake_install.cmake". In order for cmake to generate a make file for the new plugin, we need to add an entry to these cmake files in the parent directory, and modify the cmake files in the new plugin directory.
  
Under parent directory, say CalVR/plugins/calit2/CmakeLists.txt, add the following lines:
+
Under the parent directory, e.g., CalVR/plugins/calit2/CmakeLists.txt, add the following lines:
 
  OPTION(PLUGIN_EXAMPLEPLUGIN "ExamplePlugin" ON)
 
  OPTION(PLUGIN_EXAMPLEPLUGIN "ExamplePlugin" ON)
  
Line 67: Line 68:
 
  INCLUDE("~/CalVR/plugins/calit2/ExamplePlugin/cmake_install.cmake")
 
  INCLUDE("~/CalVR/plugins/calit2/ExamplePlugin/cmake_install.cmake")
  
Under new plugin directory you may remove the CMakeFiles folder as well as the old Makefile which were copied from ModelLoader. There should be only two source files and two cmake files left. Modify these files to adapt the new plugin's name.  
+
Under the new plugin directory you may remove the CMakeFiles folder as well as the old Makefile which were copied from ModelLoader. There should be only two source files and two cmake files left. Modify these files to adapt the new plugin's name.  
  
 
Launch cmake, delete the cache if necessary, configure and generate again. Note that under the PLUGINS entry, the calit2 checkbox should be on, and you should be able to find your new plugin name under PLUGIN along with the ModelLoader.  
 
Launch cmake, delete the cache if necessary, configure and generate again. Note that under the PLUGINS entry, the calit2 checkbox should be on, and you should be able to find your new plugin name under PLUGIN along with the ModelLoader.  

Revision as of 07:53, 20 February 2011

Contents

Overview

This wiki page was created to give programmers an overview of how to use IVL's virtual reality visualization framework CalVR. Special emphasis is given to those programmers who already know how to write code for COVISE.

CalVR Specs

  1. Operating system: CentOS 5 Linux
  2. Programming language: C++
  3. Graphics API: OpenSceneGraph
  4. Build system: CMake
  5. Tracking APIs supported: VRPN, TrackD
  6. PC cluster support
  7. Support for multi-screen virtual reality systems

Building OSG

The developer release of OSG can be found here. Go to main OSG directory and type ccmake . In CMAKE_BUILD_TYPE, press Enter to edit the field, type in one of the options that with debug information: RelWithDebInfo Press 'c' to configure, press 'g' to generate. and 'q' to quit. Now type make to build. Go get coffee.

Building CalVR

Make sure all CalVR Dependencies (OSG, Mini XML, GLEW) are specified by environment variables. If not, set them in the shell startup script (eg, .cshrc, .bash_profile).

Run cmake/bin/cmake-gui, let CalVR/ be both source and binaries.

Click Configure, select Unix Makefile, and it should show a configuration list for CalVR.

Navigate to OSG-->OSG_LIBRARY, if it is NOTFOUND, you may need to point it to your osg/lib, this is an example input:

 -L/home/hwang/CalVR/externs/osg/lib -losgFXrd -losgParticlerd -losgTextrd -losgSimrd -losgGArd -losgViewerrd -losgDBrd -losgShadowrd -losgUtilrd -lOpenThreadsrd -ldl

Note that many -losg*rd inputs, where are different than the IVL OSG_LIBRARIES, with extra "rd" tails (release and debug). In some configurations the libraries may no have "rd" tailing.

You may also turn on PLUGINS->PLUGINS_CALIT to build your plugin at the same time.

Click Generate, when it is done, you may exit the GUI.

In the CalVR folder, type make to build.

Runing CalVR

Before runing CalVR you need to add osg/lib into your LD_LIBRARY_PATH in .cshrc

Add an environment variable to .cshrc, for example:

setenv CALVR_HOME /home/hwang/CalVR/

The main CalVR executable is CalVR/bin/CalVR.

Adding a new Plugin for CalVR

Use CalVR/plugins/calit2/ModelLoader as a template:

Make a copy of the ModelLoader folder, rename it to <YourPluginName>. Each source code directory has the files "CMakeLists.txt" and "cmake_install.cmake". In order for cmake to generate a make file for the new plugin, we need to add an entry to these cmake files in the parent directory, and modify the cmake files in the new plugin directory.

Under the parent directory, e.g., CalVR/plugins/calit2/CmakeLists.txt, add the following lines:

OPTION(PLUGIN_EXAMPLEPLUGIN "ExamplePlugin" ON)
IF(PLUGIN_EXAMPLEPLUGIN)
 ADD_SUBDIRECTORY(ExamplePlugin)
ENDIF(PLUGIN_EXAMPLEPLUGIN)

Under parent directory, say CalVR/plugins/calit2/cmake_install.cmake, find:

IF(NOT CMAKE_INSTALL_LOCAL_ONLY)

add the following line (change to absolute path):

INCLUDE("~/CalVR/plugins/calit2/ExamplePlugin/cmake_install.cmake")

Under the new plugin directory you may remove the CMakeFiles folder as well as the old Makefile which were copied from ModelLoader. There should be only two source files and two cmake files left. Modify these files to adapt the new plugin's name.

Launch cmake, delete the cache if necessary, configure and generate again. Note that under the PLUGINS entry, the calit2 checkbox should be on, and you should be able to find your new plugin name under PLUGIN along with the ModelLoader.

Go back to the plugin directory, the new Makefile should have been generated. Type make to build.

Now we need to modify the CalVR/config/config.xml to turn on the new plugin. We can search for ModelLoader and add the exact lines to config.xml, and modify the names to the new plugin's name. Now run CalVR, in the terminal we should see the init message of the new plugin.