Chapter 2. Our First OpenGL Program

What You’ll Learn in This Chapter

• How to create and compile shader code

• How to draw with OpenGL

• How to use the book’s application framework to initialize your programs and clean up after yourself

In this chapter, we introduce the simple application framework that is used for almost all of the samples in this book. This shows you how to create the main window with the book’s application framework and how to render simple graphics into it. You’ll also see what a very simple GLSL shader looks like, how to compile it, and how to use it to render simple points. The chapter concludes with your very first OpenGL triangle.

Creating a Simple Application

To introduce the application framework that’ll be used ...

Get OpenGL® SuperBible: Comprehensive Tutorial and Reference, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.