The next step after importing the 3D model is to display the content on the screen using an intuitive and aesthetically pleasing way. Many complex scenes consist of multiple surfaces (meshes) and many vertices. In the previous chapter, we implemented a simple shader program to visualize the point cloud at various depth values based on a heat map. In this section, we will utilize very simple primitives (points, lines, and triangles) with transparency to create skeleton-like rendering effects.
We will continue the implementation of the ObjLoader
class to support loading vertices and draw the graphics for each mesh in the scene.
In the source file of ObjLoader.cpp
, we add a recursive function to extract all vertices from the scene and store them in a single vertex buffer array. This allows us to reduce the number of vertex buffers to be managed, thus reducing the complexity of the code:
void ObjLoader::loadVertices(GLfloat *g_vertex_buffer_data...