Slide Puzzle Application Update

The slide puzzle application is nearly complete, but progress has been slow due to various other projects and responsibilities that hit along with summer this year.

I need to add a few more features for capturing and saving images to use as the puzzle image, but I will start writing up the basics soon. For this application, we’re going to start with a basic OpenGL ES Application template, create the code to manage the slider puzzle, and then add the code to handle image selection and capture on top of it.

We’ll be doing a lot more work in the graphical designer for this project, so there will be a lot more steps involved in setting up and managing our interface. More steps means more pictures, which means larger chapters and a longer tutorial! Although the going will be slow over the summer here, I’ll try to get as much out over the next several weeks as I can.


Next Tutorial In Progress

The next tutorial project is in progress, and will cover a tile puzzle application. An OpenGL ES template will be used to form the primary screen of the puzzle, and new tile and manager classes will be used to make the tile puzzle work. On top of that, we’ll add navigation and a main menu, complete with the ability to choose from a set of included puzzle images, a picture from your photo library, or a picture from your built in camera, if available.

Most of the code for managing the menu system and the slider puzzle graphics are in place, but I still need to complete the code to manage the movement of the pieces and to detect when the puzzle has been solved.

There are also a few tricky bits, especially regarding the image picker and converting the collected images to OpenGL textures. I want to make sure I understand the code and can document everything properly before before I publish anything.

Look for some new material in the next week or so!


Revisions and Site Additions

I’m very pleased to announce that Endodigital.com now has forums and a shop.

If you have comments, questions, or just feel like starting a conversation about something, drop by the Endodigital Discussions forums and say hello.

The new Endodigital Shop is now online as well, offering very reasonably priced PDF versions of the Endodigital tutorials. The tutorials here on Endogitial will always be free and available for the world to use, but if you’d like to support the site, drop by the store and see what’s new.

As part of the effort in preparing the final versions of the PDF tutorials, I have revised some of the content in the original OpenGL ES 2.0 on the iPhone tutorial, including a new, better-drawn set of explanatory diagrams (I found my ruler).

Thanks for visiting!


Complete TouchTargets Tutorial Published

The complete TouchTargets tutorial has now been published, with the new content starting with Chapter 11: Aim…

The new chapters cover the creation and implementation of the new target and target manager classes, how to handle scoring, and creating and implementing an animated background. The final chapter, Chapter 15: Finishing Touches, walks through a complete Instruments session to find and correct any and all memory leaks and memory management bugs. The leak-free code can be downloaded at the end of Chapter 15.

I think this tutorial series turned out pretty well, and I hope you enjoy it. Questions and comments are welcomed.

Good luck to all with your apps!


Second Set of TouchTargets Code Published

All of the code needed to scan in, draw, and manage text strings from font sheets is in and has been published. Chapter 4: Say “Hello, World!”, OpenGL starts us off with a walkthrough of what we want to accomplish with the new font scanner, and how it will work conceptually.

Chapter 5: Building the Importer walks us through the actual code involved in creating the importer.

After that, in Chapter 6: Using the Importer, we think through what our text string class needs to be able to do to work well with the new importer class. We also start to think about coordinate systems and another class to manage all of our text strings.

Chapter 7: Creating the Text Class takes us on a long journey through the creation of the EDTextString class, a complicated but versatile class that allows us to take the data created by the font importer class and actually create and manipulate OpenGL texture-based dynamic text strings.

At the end of Chapter 7, we find that we still have a few pieces missing from our text rendering system, and finish up the effort with the final class, the EDTextStringManager. Chapter 8: Managing Our Text Strings walks through the creation of the final text handling class, and even takes time out to create a new utility class to contain our texture loading code, EDOpenGLTools.

At last, Chapter 9: Finally, OpenGL Says “Hello, World!”, and More takes all of our hard work from chapters 4 through 8 and creates an iPhone “Hello, World!” demo application.

With this set of code, we’re well on our way to finishing the TouchTargets application. All that’s left are the targets, which we’ll tackle in the next set of chapters, the background, and a scoring mechanism.


TouchTargets Chapters Published

The first part of the TouchTargets application tutorial has been published in three parts. Chapter 1: Rounding Up OpenGL identifies all of the code we’re trying to remove from the view controller and encapsulate in its own class.

Chapter 2: Pulling Out OpenGL goes over the creation of a new EDOpenGLProgram class that implements the dynamic creation and handling of shader attributes and uniforms. This new class will prove to be very handy as we create new elements for our OpenGL rendering process.

The final chapter, Chapter 3: Converting to the New EDOpenGLProgram Class walks through all of the changes necessary to our view controller to implement the new code.

The next issue we’ll tackle will be drawing text strings in OpenGL space, something that’s an absolute must for developing games, but not supported very well by the basic OpenGL system.


TouchTargets Application

I’ve been having a lot of fun with OpenGL ES 2.0 on the iPhone, and I’ve really come to appreciate some of the features in Xcode 4 that makes developing software on OS X and iOS a real pleasure.

Lately, I’ve been playing around with separating the OpenGL ES functionality from the view controller, and managing the various coordinate systems like OpenGL space and the iPhone screen. I even played around with coding a Mandelbrot set explorer that introduced a third coordinate system on top of all that, but I didn’t feel that it would make a good tutorial topic.

What I did do, however, was create a simple target game that features some really neat support classes, including an OpenGL program class, a font sheet importer that can scan characters from specially-formatted font sheets, and a host of other fun tricks. I’ll be starting a new tutorial series soon that will walk through all of the new classes, and how they can be used to easily create a touch target game like the one pictured here. In fact, they did create the game pictured here, and we’ll be building that app over the next few weeks.

As usual, I did everything the hard way, but without having to rely on third-party classes or libraries, we get to see how everything works from the ground up. It should be a lot of fun, but it’s going to take a little while to write up the tutorial text. The font sheet importer is a bit of a beast, but it will allow us to read in a sheet of characters and create fully customizable text strings anywhere in OpenGL space, even accommodating multiple fonts at once.

Check back for TouchTargets Chapter 1: Rounding Up OpenGL, available soon.


Cube maps and velocity

The latest article, Adding a Cube Map and Velocity, has been published. This article adds the animation loop back in and implements velocity, so you can ‘flick’ the cube and watch it spin until it slowly comes to a stop.

We also throw in five cube maps and cycle through them by double-tapping on the iPhone screen.

There’s now a groovy reflection on the cube from mixing the original Apple logo texture with the new cube maps. The code for this Xcode project can be downloaded here: EDCubeDemoCubeMap.zip.


Multiple textures on the cube

A reader asked about applying multiple textures on the cube, so I’ve created a new sample project and article to show one way it can be done.

Researching alternatives also turned up some neat stuff we can try with cube mapping, which I’m working with right now for my next sample project and article. I’m going to put our cube in a larger cube that will employ cube mapping to make an environment around us.

I found a link on Wikipedia to a set of awesome cube maps at www.humus.name. I’m going to use one of those to make a decent sample project for cube mapping under OpenGL ES 2.0 on the iPhone. I’ll post more information once I’ve completed the new project.

Happy coding.


All chapters published

All seventeen chapters of the OpenGL ES 2.0 on the iPhone tutorial have been published.

This series will take you from the vanilla code template generated by Xcode 4 all the way to the final project featuring a textured, interactive cube that rotates and zooms. The various matrices and shader operations are also explained in detail.

Happy programming!