slow OpenGl or RunLoop misunderstanding ?

Xavier Glattard <[email protected]>
Newsgroups gmane.comp.lib.gnustep.user
Message-ID <[email protected]>
Hello

<newbie=ON>
I'm playing with NSOpenGLView and trying to port glxgears to gnustep. 
I reuse as code from glxgears as possible.

With glxgears I get 2225 FPS
With gnustep-gears I get 380 FPS !

Even when I draw nothing in my window (drawRect = flushBuffer) i only 
get 480 FPS.

I think of 2 point :
- NSOpenGL* classes are very CPU intensive
- my frame loop is bad

I use [RunLoop-performSelecto:...] to loop. The documentation says the 
selector is perform before the next runloop iteration.

<CODE>
- (void) nextAnimationFrame: (id) gl_view
{
  NSTimeInterval thisFrame = [NSDate timeIntervalSinceReferenceDate];
  NSTimeInterval sinceLastFrame = (thisFrame - _lastFrame);
  _lastFrame = thisFrame;
  
  [_scene nextFrameWithStep: sinceLastFrame];
  [gl_view setNeedsDisplay: YES];
  
  if(YES == _running)
  {
    if (!_rl_modes)
    {
      _rl_modes = [[NSArray alloc] initWithObjects: NSDefaultRunLoopMode,
			       NSModalPanelRunLoopMode,
			       NSEventTrackingRunLoopMode, nil];
    }
    [[NSRunLoop currentRunLoop]
	 performSelector: @selector(nextAnimationFrame:)
		  target: self
		argument: gl_view
		   order: 10
		   modes: _rl_modes];
  }
}
</CODE>

Does the RunLoop iteration timed ? I hope it runs as fast as possible...

Any comment will be welcome !  :-)

Thanks in advance

xavier
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.