0

I'm writing an OpenGL app which draws trails/strokes by not clearing the frame buffer from frame to frame (it just lets everything accumulate on top of itself, which is what I want).

The app has a Settings screen. You access it by tapping a button. After you're done with the settings, it returns to the graphics.

Here's the problem: I can't figure out how to transition from the settings back to the graphics without losing what was in the frame buffer. The app is sort of a painting toy. You'd like to be able to paint, go to the settings, and then return to what you were doing without the screen clearing and deleting your work!

If I used a NavigationController all of this would be taken care of (I've tried it -- works perfectly!)

Problem is, I don't want the ugly, bulky nav bar thing on the top of my screen. But, you have to take the nav bar if you want the nav controller.

Any ideas?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Anna Dickinson
  • 3,307
  • 24
  • 43

2 Answers2

0

Your solution is simple. Hide the navigation bar.

navController.navigationBar.hidden = YES;

See here:

UINavigationController without navigation bar?

Community
  • 1
  • 1
Brian
  • 6,910
  • 8
  • 44
  • 82
  • If you hide the nav bar, you hide the button on it as well; you can't do a push segue without using the nav bar. If there was a way use a custom image for the bar and button, that would work. I could just make the bar invisible, and use my own button. But, I don't think you can customize the nav bar. – Anna Dickinson Jul 25 '12 at 20:42
  • Yes, you can customize it. http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html – Brian Jul 25 '12 at 22:00
  • No, you can't customize it in the way I described. You can change the color and transparency and what not, but you can't make it invisible. Let me explain it again: One way to solve the problem I mention (there are hopefully other ways, too) is to use a Navigation Controller. But, Navigation Controller requires using a Navigation Bar to move between views. But, I don't want to see the Navigation Bar. There is no way to use, say, custom button icons and a custom background image to make it appear in a way which would fit my app. So, that's probably not going to work. – Anna Dickinson Jul 25 '12 at 22:33
  • If it were me I would hide the navigation bar, put your custom button on top of the view and have the button invoke your navigation controller manually. I guess you could go the hard route and copy the pixels into memory, use your manual navigation method and then re-copy them to the screen once the user returns from the settings view. – Brian Jul 25 '12 at 23:01
  • Yes, I tried the hard route, but I couldn't get it to work. Drawing an EAGLayer to a bitmap context doesn't seem to be supported. I'll try your other idea. – Anna Dickinson Jul 26 '12 at 02:08
0

Before you leave to go to the settings, save what's in the framebuffer with glReadPixels. When you return, load that data into a texture and draw it on the screen.

ryanm
  • 2,979
  • 18
  • 22