I only have a basic understanding of OpenGL, so I'm probably showing my ignorance here.

I'm looking for a great iPhone/OpenGL-ES example of applying a texture (preferably from a texture atlas, but not really a requirement) to specific parts of some arbitrary object/model.

I have a game where 3D tiles "flip" to reveal some other texture on the backside of the tile. I created the model in Blender and exported it to an Objective-C header. The tile isn't a simple "cube", but it is relatively cube-shaped. Everything works great when I use a single texture that simply wraps the entire model. But I'm struggling to figure out how I can restrict that texture to just specific parts of the model.

To complicate things even more, I ultimately want to texture it with three different images. The top will have "image x", the sides of the tile will have "image y", and the back will have "image z".


  • \$\begingroup\$ Did you texture the 'cube' in Blender and export the texture or is this a new texture you want to use? \$\endgroup\$
    – Dave
    Aug 21, 2010 at 11:03
  • \$\begingroup\$ I only have a simple material on the cube in Blender just so the texture coordinates export. The textures on the top and bottom faces are runtime textures. The sides can be exported with the object (if possible). Maybe this is a limitation of exporting everything as an Objective-C header file... ?? \$\endgroup\$
    – Tim Reddy
    Aug 21, 2010 at 18:01

1 Answer 1


You're doomed.

The iPhone only has 2 multitexturing units, so you can't use 3 textures at the same time. This leaves you with the following options :

  • Make a single texture with your 3 images on it. If the combination of textures is not a compile-time constant, either recompute the new texture each time you need it, or pre-compute every possibility.
  • Split your cube into 3 meshes, display each independently with its own texture
  • Hybrid approach : Split your cube in 2, first half with 1 texture, second half with multitexturing.

Hope this helps.

  • \$\begingroup\$ Thanks for the answer. Do you have some source code for your first answer? I guess that's why I started investigating texture atlases... \$\endgroup\$
    – Tim Reddy
    Aug 22, 2010 at 15:21
  • \$\begingroup\$ @TReddy : No, not really, but simply create a texture large enough so that the 3 fit (and still power of two), memcpy (or the C# equivalent) 3 times, render. \$\endgroup\$
    – Calvin1602
    Aug 22, 2010 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .