OpenVDB is a new library by DreamWorks which contains data structures and tools for work with three-dimensional grid. For instance, it can be used to work with level-sets. On the openvdb web site it is written that it is checked to be build only on RedHat Linux, so I decided to save my experience about making it on the MacOS (Lion, 10.7.5), with gcc 4.7.2 and openvdb-v0-103-1.
There are two ways of building openvdb - build it under Houdini environment (you need to install houdini) and the second way using macport(no need in Houdini,
this way is described in the post). In order to build openvdb using Houdini, go to Applications/Houdini
make and everything should be built. Yet, you may have problems with vdb_view, they are fixed in the patch, have a look inside. If you use a newer version, you will have problems with the HDK’s boost which is 1.46. I just renamed the folder with boost in hdk and specified path to a more recent version. Just in case if you forgot, if you want to build openvdb with
sudo, you need to use
sudo -E instead in order to have all environment variables on place.
Now, how to build OpenVDB without using Houdini and with the modern gcc. First of all, you need to have macports installed, then I would recommend to install the latest gcc. After that install OpenVDB dependencies:
1 2 3 4
The only problem is to install optional package
glfw (download sources):
1 2 3 4 5
pkg-config libglfw.pc In order to simplify linkage of openvdb with glfw (it requires opengl and cocoa), do pkg-config in glwf home:
1 2 3 4
After that you need to set up paths to libraries and includes in Makefile in the openvdb directory. I made several modifications in the openvdb, all of them can be extracted from the patch: - modified Makefile - added boost-system-mt library, added dependencies for vdb_view and other changes - modified vdb_view code so it can work with OpenGL 2.1 and GLSL version 120 - modified one test which can not be compiled without a error in the gcc4.7.2
In order to apply patch:
When you are done, run
make install in the OpenVDB src directory. You may try to run vdb_view from the
bin directory in the your openvdb installation path.
In order to do that, download on of the shapes from the openvdb site, for instance icosahedron and run:
The result should look like on the figure below:
Then you may run tests (it takes a lot of time so I would skip it).
When I did it, I found a error (testIO) which leads to program termination. The problem is in cpp-unit I use (1.12.1), to fix it comment call of
CPPUNIT_ASSERT_NO_THROW in the
TestCoord.cc lines 120 and 123.
When you will try to use your openvdb library you may have problem: dyld cannot find an image. To fix this problem you may write