views:

325

answers:

1

Hi, I was wondering if anyone could help me out implementing a flipview within an OpenGL ES iPhone template?

+1  A: 

This is pretty easy to do. You can create a Utility Application from the template in Xcode, which already has the view-flipping implemented. Take the boilerplate OpenGL ES view code generated by the OpenGL ES Application template and replace the main (or flipside) view's code with the OpenGL ES view's. That should be enough to make a functional application to start with.

For an example of this in action, you can download the source code to my iPhone application Molecules, which has an OpenGL ES view on its main side and a navigation view controller on its flipside. It's a little more complex than the templates I describe above, but it is a fully functional application that does what you're looking for.

Brad Larson
I did exactly this today and even tried to use your Molecules app to help myself but it was a little to complex to aid me! I will have another go at this in an hour or so.
ing0
What part of the template-based approach gave you trouble? You should be able to just drop in the EAGLView class from the OpenGL ES template in place of the MainView class in the utility one, then change the class of the view in MainView.xib from MainView to EAGLView.
Brad Larson
I think I was over complicating things! I'll have a crack at it again in a second and update here! Thanks for the help!
ing0
It depends on what you are trying to do. In my application, I simply respond to touch events, which trigger a redraw of the OpenGL context. I do have an auto-spinning feature in the latest version, which causes redraws at a regular rate using an NSOperationQueue. You could just as easily do this by starting an NSTimer and causing it to trigger OpenGL refreshes at a regular interval. The timer can be started anywhere, depending on when you want the animation tp start. The OpenGL ES application template starts this in -startAnimation within the EAGLView.
Brad Larson
Thanks for your help with this. For those wondering, I was trying to call startanimation from the app delegate as you would in the normal OpenGL template. Instead if you add it too the mainviewcontroller in the utility template and make sure you set the link up in IB between the view and glView!!
ing0