• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Slower with Cocoa subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Slower with Cocoa subclass
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Re: Where is Xcode?
  • Next by Date: Re: XCode or code problems?
  • Previous by thread: NSOpenPanel and Selecting ONLY a volume?
  • Next by thread: Re: Slower with Cocoa subclass
  • Index(es):
    • Date
    • Thread