Option number 1, rendering every object in a different color sounds like it would take more time, I am running on a phone with limited processing power.. option number two creating a ray out of the coordinates and the viewing frustum sounds more like what I want(assuming its less processing time)....
So how would one take the coordinate from the touch and map it to the frustum? the touch events coordinates are on a coordinate axis with x increasing left to right and y increasing top to bottom, my coordinate space, at least as I am familiar with it has a y increasing bottom to top and has negative values...
also how would I go about making this ray and intersecting it with objects within the space? could you point me in a direction where I could see examples?
Thanks for your help,
Huh, cool idea, Riven.
If everything you have is simply shaped then option 1 should be fine for you. Rendering to an FBO is pretty cheap if you never render it to the screen. If you're doing a whole lot of rendering and pushing things to the limit then this may
not be the case, but you can do things like color render bounding boxes to keep it simple and relatively accurate. Remember there is a reasonable overhead to raycasting as well, and it's a massive amount of work to do properly. Also remember the very important fact that you don't need to care at all about the entire screen, you only need to care about the single pixel where the user is touching. That means you can make a really really tiny FBO (even like 8x8 or something), then use bounding boxes to decide what to draw onto the FBO, and this approach will be lightning fast.
I also know of a very high-profile incredibly successful iPhone game (not one of my company's) that renders every single character
to an FBO before drawing it to the screen. That's like 20 or 30 128x128 FBOs per frame sometimes, and these are trashed and recreated repeatedly.
I'm not advocating for Riven's method, I'm just saying don't rule it out for performance reasons. In 99% of cases it should be just fine, as long as you're not trying to deploy on iPhone 3G or the Hero or some other old shitty devices. And if you're doing that then your game is going to choke anyway.