Difference between revisions of "CalVR Plugins"
m (New page: ==Overview== ==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 cod...) |
|||
Line 3: | Line 3: | ||
==Adding a new Plugin for CalVR== | ==Adding a new Plugin for CalVR== | ||
− | Use | + | Use (CVRPlugins Dir)/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. | 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. | ||
Line 13: | Line 13: | ||
ADD_SUBDIRECTORY(ExamplePlugin) | ADD_SUBDIRECTORY(ExamplePlugin) | ||
ENDIF(PLUGIN_EXAMPLEPLUGIN) | ENDIF(PLUGIN_EXAMPLEPLUGIN) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
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 11:16, 21 November 2011
Overview
Adding a new Plugin for CalVR
Use (CVRPlugins Dir)/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)
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.