
If you’ve read the Core Graphics 101 tutorial series, many of these calls will look familiar. Luckily, you can get this buffer of pixel data quite easily using some built-in Quartz2D functions. Instead, OpenGL requires you to send them as a buffer of pixel data – and you need to specify the exact format. The problem is OpenGL doesn’t accept images the way it’s handy to use them as programmers (paths to PNGs). Our first step is we have to somehow give the image data to OpenGL. We’ll start by applying the floor tile around each face of the cube. You’ll see there are two images – one that looks like a floor tile, and one that looks like a fish. Then drag the folder into your Xcode project, make sure that “Copy items into destination group’s folder” is selected, and click Finish. Start by downloading these textures made by my lovely wife and unzip the folder. Right now the cube looks green and red because we colored the vertices that way – it doesn’t have any texture applied.īut don’t worry – that’s exactly what we’re going to do in this tutorial! If you don’t have it already, download a copy of the sample project where we left it off in the previous tutorial.Ĭompile and run the project, and you’ll see a rotating cube: OK, let’s dive into OpenGL ES 2.0 textures! If I make any boneheaded mistakes, feel free to chime in with corrections or insights! :]


In this part of the tutorial series, we’re going to take things to the next level by adding some textures to our cube!Ĭaveat: I am not an Open GL expert! I am learning this myself, and am writing tutorials as I go. In the first part of the series, we covered the basics of initializing OpenGL, creating some simple vertex and fragment shaders, and presenting a simple rotating cube to the screen. In this tutorial series, our aim is to take the mystery and difficulty out of OpenGL ES 2.0, by giving you hands-on experience using it from the ground up!
