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 ...
Get OpenGL – Build high performance graphics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.