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 Vertex and Index Buffer Objects

To load in the height map, we’re going to use two new OpenGL objects: a vertex buffer object and an index buffer object. These two objects are analogous to the vertex arrays and index arrays that we’ve been using in previous chapters, except that the graphics driver can choose to place them directly in the GPU’s memory. This can lead to better performance for objects that we don’t change often once they’ve been created, such as a height map. These buffer objects aren’t always faster, though, so it does pay to compare both options.

Creating a Vertex Buffer Object

To load in these buffer objects, we’ll need to create some supporting code. Let’s create a new class called VertexBuffer in the com.particles.android.data ...

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