Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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 (16) Chapters Close

OpenGL Data Visualization Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
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

Rendering 3D models with points, lines, and triangles


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.

How to do it...

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...
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 $15.99/month. Cancel anytime
Visually different images