O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

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

Creating a Renderer Class

Now we’re going to define a Renderer so that we can start clearing the screen. Let’s take a quick overview of the methods defined by the Renderer interface:

onSurfaceCreated(GL10 glUnused, EGLConfig config)

GLSurfaceView calls this when the surface is created. This happens the first time our application is run, and it may also be called when the device wakes up or when the user switches back to our activity. In practice, this means that this method may be called multiple times while our application is running.

onSurfaceChanged(GL10 glUnused, int width, int height)

GLSurfaceView calls this after the surface is created and whenever the size has changed. A size change can occur when switching from portrait to landscape and ...

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