Slower with Cocoa subclass
Slower with Cocoa subclass
- Subject: Slower with Cocoa subclass
- From: Lorenzo <email@hidden>
- Date: Fri, 31 Oct 2003 14:37:05 +0100
Hi,
when I run using the local functions "placeObject" and call
------------------------------------
- (void)drawRect:(NSRect)rect
{
int i;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
for(i = 0; i < totObjects; i++){
[self placeObject:i];
}
[[self openGLContext] flushBuffer];
}
------------------------------------
everything works well and very fast.
But if I create a NSObject subclass myCube
------------------------------------
objectsToDraw = [[NSMutableArray alloc] init];
for(i = 0; i < totObjects; i++){
myCube = [[SBCube alloc] init];
[objectsToDraw addObject:myCube];
[myCube release];
}
------------------------------------
when I call
------------------------------------
- (void)drawRect:(NSRect)rect
{
int i;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
for(i = 0; i < [objectsToDraw count]; i++){
objectToDraw = [objectsToDraw objectAtIndex:i];
[objectToDraw placeObject];
}
[[self openGLContext] flushBuffer];
}
------------------------------------
everything runs slower.
I simply moved the previous routine "placeObject" from the "self" class
to the "SBCube" class. So, why now does my application run slower?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.