Drawing menu versus drawing game

Member
Posts: 65
Joined: 2009.01
Post: #1
I am wondering about how deal with deciding which needs to be draw on a given cycle of my game: the game view or a menu view. In a pure OpenGL version, I would have a game state variable the would tell the render() method which one to draw.
But I am confused about how to do this in a standard iPhone (UIKit) arrangement. If I have a root view controller that controls the game view and menu views, where does the main loop belong? In the AppDelegate class, or down in the game view class? But then I would still need a way to communicate back up to the AppDelegate in order to switch between views...
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
Why not just do a pure OpenGL version of it and be done with it? Mixing in UIKit widgets with your OpenGL stuff can kill performance anyway. I fiddled with trying to play moderator between OpenGL and UIKit for long enough and simply gave up. There just isn't enough machine available to reliably do both IMHO. You *can*, but it's a trick sometimes, which I don't think is worth the trouble.
Quote this message in a reply
Member
Posts: 65
Joined: 2009.01
Post: #3
I'm sorry, I shouldn't have said UIKit...I meant MVC and all that. If I have to use a UIViewController to swap views between a game view and one or more menu views, where does that fit in with the game's main loop?
Quote this message in a reply
Member
Posts: 353
Joined: 2002.04
Post: #4
I'm no expert but I think a few developers here (myself included) have a single view for all drawing and manage the state like you mentioned in your first post as a pure OpenGL version.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #5
I'm with monteboyd, and have only one glView and skip any MVC for games.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL Cube drawing: VBOs, instanced geometry, octrees Symbol$ 5 9,089 Dec 23, 2011 01:43 PM
Last Post: Skorche
  obj versus .h models OptimisticMonkey 3 2,537 Jul 27, 2010 07:46 AM
Last Post: OptimisticMonkey
  OpenGL ES : Drawing Text... savage 8 10,055 Jan 4, 2010 08:59 PM
Last Post: alerus
  Drawing Anti-Aliased Shapes With Open GL muleskinner 4 3,956 Nov 17, 2009 10:01 AM
Last Post: warmi
  openGL n00b looking for FBO drawing examples or direction auptown 5 7,220 Nov 4, 2009 02:16 AM
Last Post: Eskema