Switching to another EAGLView help.
Hi!
I'm running into a few problems trying to switch from one EAGLView to another.
This is what RootView.m looks like (RootView is a subclass of UIView which I use to switch between views):
The battleScene is the other OpenGLES View and the randomView is just a normal UIView with a white background.
I cannot get this to work.
I call goToBattleScene in glView and when randomView is uncommented it works but when battleScene is uncommented i get a blank grey screen with some error that keeps repeating.
I'm thinking it has something to do with the line:
This is all in code with no IB and no UIViewControllers.
Any help and advice on best practices would be appreciated, thanks.
I'm running into a few problems trying to switch from one EAGLView to another.
This is what RootView.m looks like (RootView is a subclass of UIView which I use to switch between views):
Code:
#import "RootView.h"
#import "EAGLView.h"
#import "BattleScene.h"
#import "RandomView.h"
@implementation RootView
@synthesize glView, battleScene, randomView;
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
gameFrame = self.bounds;
glView = [[EAGLView alloc] initWithFrame:gameFrame];
[self addSubview:glView];
//battleScene = [[BattleScene alloc] initWithFrame:gameFrame];
//[self addSubview:battleScene];
glView.rootView = self;
}
return self;
}
- (void)goToBattleScene {
battleScene.rootView = self;
[glView removeFromSuperview];
battleScene = [[BattleScene alloc] initWithFrame:gameFrame];
[self addSubview:battleScene];
//randomView = [[RandomView alloc] initWithFrame:gameFrame];
//[self addSubview:randomView];
}
- (void)dealloc {
[glView release];
[battleScene release];
[randomView release];
[super dealloc];
}
@endThe battleScene is the other OpenGLES View and the randomView is just a normal UIView with a white background.
I cannot get this to work.
I call goToBattleScene in glView and when randomView is uncommented it works but when battleScene is uncommented i get a blank grey screen with some error that keeps repeating.
I'm thinking it has something to do with the line:
Code:
glView.rootView = self;This is all in code with no IB and no UIViewControllers.
Any help and advice on best practices would be appreciated, thanks.
Problem solved.
jeonghyunhan Wrote:Problem solved.
So what was the fix?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Switching between UIViewContollers | mberger | 2 | 2,384 |
May 10, 2010 12:20 PM Last Post: maximile |
|
| How to access EAGLView/UIView functions from C? | Rasterman | 10 | 5,146 |
Apr 8, 2010 10:47 AM Last Post: Rasterman |
|
| View is not switching | jeonghyunhan | 9 | 3,596 |
Mar 10, 2009 03:13 PM Last Post: maximile |
|

