Introduction to OpenGL ES#

This tutorial is a step-by-step guide to writing a basic OpenGL ES application. It is based on the HelloAPI example included with the PowerVR SDK.

Drawing a triangle is one of the most basic OpenGL ES applications that produce some visible output. The example application in this guide renders a textured triangle to screen which rotates in place for a pre-defined period. This makes it a great introduction to OpenGL ES and graphics programming in general.

Along the way, this guide will introduce the basic concepts of 3D rendering and OpenGL ES, as well as how to set up OpenGL ES applications and draw simple primitives to screen.

Important notes for this guide#

In addition to the OpenGL ES API, the application in this guide also makes use of EGL and GLM.

  • EGL is an API which interfaces between the native windowing system of a platform and OpenGL ES, as well as other rendering APIs. This allows the same OpenGL ES application to be used on many different platforms without setting up native windows within the application itself.

  • GLM is a mathematics library which provides classes and functions that are commonly used in graphics programming such as matrix and vector manipulation.

The example application OpenGLESHelloAPI.h’s header file includes the DynamicGles.h and DynamicEgl.h files to load OpenGL ES and EGL function pointers. These files are packaged with the PowerVR SDK, and using them in an application means OpenGL ES and EGL functions are immediately available in the application. It is therefore not necessary to link against EGL and OpenGL ES directly.

The GLM files for this example are also included via the header file mentioned above. These files are also packaged with the PowerVR SDK but can be downloaded separately.

Note

The full OpenGL ES source code is included with the PowerVR SDK. It can also be found on the PowerVR Native SDK GitHub repository.

PowerVR Framework#

After following this guide, take a look at some of the other examples included with the SDK. These will help to introduce and demonstrate some common rendering techniques. All of these examples make use of the PowerVR Framework, which is a framework of modules intended to aid development with Vulkan and OpenGL ES.

One of the most useful modules in the PowerVR Framework for OpenGL ES development is PVRUtilsGles. It provides tools and helper functions to automate common initialisation and rendering tasks. This helps to remove much of the boilerplate code from OpenGL ES applications and simplifies development.