AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb
[BUG] I cannot compile my code using NanoVDB
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 774
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 34
Description
Hi guys,
I hope somebody could help me to fix this or maybe I should try an earlier commit/version. I'll leave this here anyway in cause it is useful for you guys.
### Environment
**Operating System:** (Ubuntu 22.04)
**Version / Commit SHA:** (master branch, SHA: 9153c12ed095156aad18f4a0ca7f754b97eb83da)
**Other:** (Ubuntu clang version 17.0.4 (++20231031083134+309d55140c46-1~exp1~20231031083240.62), -std=c++17)
### Describe the bug
I was trying to use OpenVDB and everything was fine untill I try to use NanoVDB. I got some some compilation errors:
```
In file included from ./src/main.cpp:8:
/usr/local/include/nanovdb/util/CreateNanoGrid.h:324:58: error: no member named 'map' in 'openvdb::v11_0::Grid, 4>, 5>>>>'
324 | const nanovdb::Map& map() const {return this->grid().map();}
| ~~~~~~~~~~~~ ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:1719:74: note: in instantiation of member function 'nanovdb::NodeAccessor, 4>, 5>>>>>::map' requested here
1719 | dstData->init({GridFlags::IsBreadthFirst}, mOffset.size, mSrcNodeAcc.map(),
| ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:961:34: note: in instantiation of function template specialization 'nanovdb::CreateNanoGrid, 4>, 5>>>>>::processGrid' requested here
961 | [&](){this->template processGrid();} );
| ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:899:34: note: in instantiation of function template specialization 'nanovdb::CreateNanoGrid, 4>, 5>>>>>::initHandle' requested here
899 | auto handle = this->template initHandle(pool);
| ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:1966:31: note: in instantiation of function template specialization 'nanovdb::CreateNanoGrid, 4>, 5>>>>>::getHandle' requested here
1966 | return converter.template getHandle(buffer);
| ^
./src/main.cpp:572:28: note: in instantiation of function template specialization 'nanovdb::createNanoGrid, 4>, 5>>>>, float, nanovdb::HostBuffer>' requested here
572 | auto handle = nanovdb::createNanoGrid(*grid);
| ^
In file included from ./src/main.cpp:8:
/usr/local/include/nanovdb/util/CreateNanoGrid.h:325:54: error: no member named 'gridClass' in 'openvdb::v11_0::Grid, 4>, 5>>>>'
325 | GridClass gridClass() const {return this->grid().gridClass();}
| ~~~~~~~~~~~~ ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:1720:85: note: in instantiation of member function 'nanovdb::NodeAccessor, 4>, 5>>>>>::gridClass' requested here
1720 | mapToGridType(), mapToGridClass(mSrcNodeAcc.gridClass()));
| ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:961:34: note: in instantiation of function template specialization 'nanovdb::CreateNanoGrid, 4>, 5>>>>>::processGrid' requested here
961 | [&](){this->template processGrid();} );
| ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:899:34: note: in instantiation of function template specialization 'nanovdb::CreateNanoGrid, 4>, 5>>>>>::initHandle' requested here
899 | auto handle = this->template initHandle(pool);
| ^
/usr/local/include/nanovdb/util/CreateNanoGrid.h:1966:31: note: in instantiation of function template specialization 'nanovdb::CreateNanoGrid, 4>, 5>>>>>::getHandle' requested here
1966 | return converter.template getHandle(buffer);
| ^
./src/main.cpp:572:28: note: in instantiation of function template specialization 'nanovdb::createNanoGrid, 4>, 5>>>>, float, nanovdb::HostBuffer>' requested here
572 | auto handle = nanovdb::createNanoGrid(*grid);
| ^
78 warnings and 2 errors generated.
make: *** [Makefile:29: main.o] Error 1
make: Leaving directory '/home/jaisiero/Projects/openvdb_sample'
```
### To Reproduce
The code is very simple yet. I got this code from one of your examples guys. This is line which throws the error:
```
// Convert the OpenVDB grid, srcGrid, into a NanoVDB grid handle.
auto handle = nanovdb::createNanoGrid(*grid);
```
### Expected behavior
I wanted to convert my OpenVDB data into NanoVDB and afterwards use it inside an GLSL shader. But I couldn't.
EDIT:
So i figured it out using this macro in my main.cpp before including NanoVDB headers:
#define NANOVDB_USE_OPENVDB
And it worked! Definitely this should be known somewhere.
Thanks!
Contributor guide
Research direction
Start with the NanoVDB include setup in src/main.cpp, especially the call at line 572 and the example mentioned in the report. Document the required NANOVDB_USE_OPENVDB definition before including NanoVDB headers, then verify that the reported conversion compiles with the stated OpenVDB and NanoVDB setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100