Skip to content

Instantly share code, notes, and snippets.

@TannerRogalsky
Created April 7, 2017 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TannerRogalsky/6be209e47de1e7e974dc7dbfd023de29 to your computer and use it in GitHub Desktop.
Save TannerRogalsky/6be209e47de1e7e974dc7dbfd023de29 to your computer and use it in GitHub Desktop.
Subdivide a polyhedron and buffer it's vertices into a VBO.
template<int32_t N>
void buffer(GLuint *vbos) {
if constexpr(N >= 0) {
const auto vertices = subdivide<N>(indexedVertices, indices);
const auto wireframe = getWireframeGeometry(vertices);
glBindBuffer(GL_ARRAY_BUFFER, vbos[N]);
glBufferData(GL_ARRAY_BUFFER, wireframe.size() * sizeof(Vertex), wireframe.data(), GL_STATIC_DRAW);
buffer<N - 1>(vbos);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment