O'Reilly logo

OpenGL Data Visualization Cookbook by William C. Y. Lo, Raymond C. H. Lo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading the first 3D model in the Wavefront Object (.obj) format

Now, we are ready to integrate a 3D object loader into our code. The first step is to create an empty class called ObjLoader along with the source (.cpp) and header (.h) files. This class handles all the functions related to 3D object loading, parsing, and drawing using the OpenGL and Assimp libraries. The headers of the class will include the Assimp core functions for the handling of the data structures and all I/O mechanisms of the 3D data format:

#include <cimport.h>
#include <scene.h>
#include <postprocess.h>

In the ObjLoader.h file, we provide interfaces for the main program to create, destroy, load, and display the 3D data. In the ObjLoader.cpp file, we implement a set of functions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required