Where can I find an iPhone OpenGL ES Example that responds to touch?

20,950

Solution 1

My iPhone application Molecules has its source code available via a BSD license. It uses OpenGL ES to render a molecular structure, using single touches to rotate the structure, a pinch gesture for zooming, and simultaneous movement of two fingers for panning across the molecule. Unfortunately, it does not yet use textures for any of the rendering it does.

I document some of the things I've learned about OpenGL ES from it here and here.

Solution 2

Sounds like you're looking for more than one example:

  1. The XCode template "OpenGL ES Application" does this.
  2. This NeHe for iPhone tutorial texture maps a cube.
  3. For this you need the arcball algorithm. Thanks, NeHe.
  4. Why not place your scene inside a texture mapped cylinder?
    Once again, NeHe to the rescue. Does that guy ever sleep!?!

You're welcome!

Solution 3

For sample OpenGL ES code that responds to touch events take a look at the GLPaint sample code from Apple.

Solution 4

I haven't found example code for this exact task, but here's a tutorial about the iPhone touch API. Using the code from there, you should be able to react on touch events. For the graphics, look at this site that contains various OpenGL ES examples.

Share:
20,950
Jamey McElveen
Author by

Jamey McElveen

I am a Christian, I have three boys, Jake, Slater, Seth and a beautiful wife Connie. Application developer using primarily .NET/C#. I am using Objective-C for iPhone development. In the past I have also developed in Java, and Delphi.

Updated on July 04, 2020

Comments

  • Jamey McElveen
    Jamey McElveen almost 4 years

    I would like to find an iPhone OpenGL ES Example that responds to touch. Ideally it would meet these requirements:

    • Displays a 3D object in the center of the screen like a cube
    • Maps a texture to the cube surfaces
    • Should move the camera around the cube as you drag your finger
    • Should zoom the camera in and out on the cube by pinching
    • Optionally has a background behind the cube that wraps around the back of the camera.(for example this could create the effect of the cube being in space)

    Has anyone seen one or more examples that can do these or at least render the cube with the texture?