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.
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.
In Visual Studio 2013, use the following steps to create a new project and compile the source code:
Tutorial1
.include
path of the GLFW library, C:Program Files (x86)glfw-3.0.4include, by navigating to Configuration Properties | C/C++ | General | Additional Include Directories.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.
glu32.lib
, glfw3.lib
and opengl32.lib
) by navigating to Configuration Properties | Linker | Input | Additional Dependencies.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: