Created
April 7, 2017 11:11
-
-
Save TannerRogalsky/6be209e47de1e7e974dc7dbfd023de29 to your computer and use it in GitHub Desktop.
Subdivide a polyhedron and buffer it's vertices into a VBO.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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