Android opengl es 2.0 texture tutorial

broken image

Like the previous example we are not going to touch the Java side as the setup code stays the same. Feel free to copy the previous project so in the end you can have both.įrom the previous project we need to add 2 new native files. This makes sense as because we are going to be using a cube in this example. For this example we are going to use the RAW format as it is the simplest but feel free to add code to use any image format you want.Īt the end of this tutorial you should have the same spinning cube as the previous example but nicely textured.įor this project we will carry on from the previous cube example. These images can be any image format that you like all you need is the code to load that particular image format in. This way one triangle can represent many different colours. Instead what we need to use is a texture.Ī texture can be thought of as like a poster or an image that you want your triangle to display.

broken image

Sure you could just have millions of triangles each representing one colour but this is impractical. This is fine for simple programs but what happens if you want more than one colour in a small area. Up until this point we have only used a single colour to represent a triangle in our examples.

broken image

The source for this sample can be found in the folder of the SDK. How to start texturing your objects to make them look realistic.

broken image