Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenGL Data Visualization Cookbook

You're reading from   OpenGL Data Visualization Cookbook Over 35 hands-on recipes to create impressive, stunning visuals for a wide range of real-time, interactive applications using OpenGL

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher Packt
ISBN-13 9781782169727
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with OpenGL 2. OpenGL Primitives and 2D Data Visualization FREE CHAPTER 3. Interactive 3D Data Visualization 4. Rendering 2D Images and Videos with Texture Mapping 5. Rendering of Point Cloud Data for 3D Range-sensing Cameras 6. Rendering Stereoscopic 3D Models using OpenGL 7. An Introduction to Real-time Graphics Rendering on a Mobile Platform using OpenGL ES 3.0 8. Interactive Real-time Data Visualization on Mobile Devices 9. Augmented Reality-based Visualization on Mobile or Wearable Platforms Index

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 to parse the scene (a hierarchical representation of the 3D objects in terms of meshes and faces) using the built-in functions from Assimp.

The Assimp library can support various 3D model data formats; however, in our example...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime