views:

19

answers:

1

Using Iphone and Objective C Im trying to find what plane has been clicked/touched in my opengl view. Typically i would use glPushName/ flPopName but this function doesn't seem to be implemented in the sdk or defined in . Does anyone know where to get there useful functions or another way to get the object that was clicked?

A: 

OpenGL ES doesn't support these functions. You'll have to find another way to pick. Either:

  1. Render solid faces with distinct colors into a low-res buffer. Select the render buffer resolution so that the pick square occupies a 3x3 pixel grid, choose either the color in the center pixel, or the color that occupies the most edge pixels.

  2. Determine the pick geometrically. This usually entails placing your geometry in a BSP of some sort and doing interesection tests with a ray emanating downwards into the screen, starting from the tapped pixel.

  3. Determine the pick analytically. If you geometry is simple and/or regular enough, you might be able to use some straightforward math to find out what you tapped.

Marcelo Cantos
I think option 1 maybe the best for me - described here:http://gpwiki.org/index.php/OpenGL_Selection_Using_Unique_Color_IDs
yeahdixon