I have been trying to fix this problem for a while and cannot understand why this is happening. It seems that this only happens when "Archiving" the application and running on the device, and not when debugging the application.
I have two classes:
@interface AppController : NSObject <UIApplicationDelegate>
{
EAGLView * glView;
}
@interface EAGLView : UIView
{
@public
GLuint framebuffer;
}
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)fformat depthFormat:(GLuint)depth stencilFormat:(GLuint)stencil preserveBackbuffer:(bool)retained scale:(float)fscale msaaMaxSamples:(GLuint)maxSamples;
and I intitializing one object like this:
glView = [ EAGLView alloc ];
glView = [ glView initWithFrame:rect pixelFormat:strColourFormat depthFormat:iDepthFormat stencilFormat:iStencilFormat preserveBackbuffer:NO scale:scale msaaMaxSamples:iMSAA ];
NSLog(@"%s:%d &glView %p\n", __FILE__, __LINE__, glView );
NSLog(@"%s:%d &glView->framebuffer %p\n", __FILE__, __LINE__, &glView->framebuffer );
With initWithFrame, it looks like this:
- (id) initWithFrame:(CGRect)frame
{
if( ( self = [super initWithFrame:frame] ) )
{
}
NSLog(@"%s:%d &self %p\n", __FILE__, __LINE__, self );
NSLog(@"%s:%d &framebuffer %p\n", __FILE__, __LINE__, &framebuffer );
return self;
}
The log displays:
EAGLView.mm:399 self 0x134503e90
EAGLView.mm:401 &framebuffer 0x134503f68
AppController.mm:277 glView 0x134503e90
AppController.mm:281 &glView->framebuffer 0x134503f10
How can the address of this member variable change when the object that contains it does not work?
source
share