Creating Our First Program

Now that we have our tools installed and configured, let’s go ahead and create our first OpenGL program. This program will be very simple: all it will do is initialize OpenGL and clear the screen continuously. That’s the minimum we need to have an OpenGL program that actually does something.

If you want to follow along in the code, all of the source code and accompanying data for this book can be downloaded from this book’s home page.[19]

Joe asks:
Joe asks:
Why Do We Need to Continually Clear the Screen?

Clearing the screen seems wasteful if we’re already drawing over the entire screen on each frame, so why do we need to do it? ...

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.