O'Reilly logo

OpenGL® ES 2.0 Programming Guide by Dave Shreiner, Dan Ginsburg, Aaftab Munshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Hello Triangle: An OpenGL ES 2.0 Example

To introduce the basic concepts of OpenGL ES 2.0, we begin with a simple example. In this chapter, we show what is required to create an OpenGL ES 2.0 program that draws a single triangle. The program we will write is just about the most basic example of an OpenGL ES 2.0 application that draws geometry. There are number of concepts that we cover in this chapter:

  • Creating an on-screen render surface with EGL.

  • Loading vertex and fragment shaders.

  • Creating a program object, attaching vertex and fragment shaders, and linking a program object.

  • Setting the viewport.

  • Clearing the color buffer.

  • Rendering a simple primitive.

  • Making the contents of the color buffer visible in the EGL window surface.

As it turns ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required