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 now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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 FREE CHAPTER 2. OpenGL Primitives and 2D Data Visualization 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

Compiling and running your first OpenGL application in Windows

There are several ways to set up an OpenGL project. Here, we create a sample project using Visual Studio 2013 or higher and provide a complete walkthrough for the first-time configuration of the OpenGL and GLFW libraries. These same steps can be incorporated into your own projects in the future.

Getting ready

Assuming that you have both Visual Studio 2013 and GLFW (version 3.0.4) installed successfully on your environment, we will start our project from scratch.

How to do it...

In Visual Studio 2013, use the following steps to create a new project and compile the source code:

  1. Open Visual Studio 2013 (VS Express 2013 for desktop).
  2. Create a new Win32 Console Application and name it as Tutorial1.
    How to do it...
  3. Check the Empty project option, and click on Finish.
    How to do it...
  4. Right-click on Source Files, and add a new C++ source file (Add | New Item) called main.cpp.
    How to do it...
  5. Copy and paste the source code from the previous section into the main.cpp and save it.
  6. Open Project Properties (Alt + F7).
  7. Add the include path of the GLFW library, C:\Program Files (x86)\glfw-3.0.4\include, by navigating to Configuration Properties | C/C++ | General | Additional Include Directories.
    How to do it...

    Tip

    Downloading the example code

    You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

  8. Add the GLFW library path, C:\Program Files (x86)\glfw-3.0.4\lib, by navigating to Configuration Properties | Linker | General | Additional Library Directories.
    How to do it...
  9. Add the GLFW and OpenGL libraries (glu32.lib, glfw3.lib and opengl32.lib) by navigating to Configuration Properties | Linker | Input | Additional Dependencies.
    How to do it...
  10. Build Solution (press F7).
  11. Run the program (press F5).

Here is your first OpenGL application showing a rotating triangle that is running natively on your graphics hardware. Although we have only defined the color of the vertices to be red, green, and blue, the graphics engine interpolates the intermediate results and all calculations are performed using the graphics hardware. The screenshot is shown as follows:

How to do it...
You have been reading a chapter from
OpenGL Data Visualization Cookbook
Published in: Aug 2015
Publisher: Packt
ISBN-13: 9781782169727
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 $19.99/month. Cancel anytime