简体   繁体   中英

Iphone opengl es - glu, glPushName

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM