Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OpenGL and events



Rather than using a standard run loop to handle events, timers to render
each frame, &c., is there any way I can make the application run in a loop
of displaying, updating the view, get events, displaying...?

From my understanding, this is exactly what happens in the standard run loop.
From the NSView docs:
-setNeedsDisplay:(BOOL)flag
NSViews marked as needing display are automatically redisplayed on each pass through the application's event loop.
Assuming your display method is tied to a NSTimer, here's what should happen (each number corresponds to a pass through the run loop):
1. timer fires calling your updating method which in turn calls -setNeedsDisplay:YES
2. view notices that it's dirty and redisplays, any events posted during 1 or 2 are handled
3. timer fires again, repeat to 1.

Of course, number 2 may take a few more passes through the run loop to complete processing if there is more than one event to be processed, but I really think this is probably what you want.

Brendan Younger


References: 
 >OpenGL and events (From: "R. Eranki" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.