Re: [Fresco-devel] MNG
Nathaniel Smith <[email protected]>
| Newsgroups | gmane.comp.video.fresco.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jun 24, 2002 at 06:09:04PM -0400, Sean Rae wrote: > Is there any thought to adding MNG (www.libmng.com) support? As far as I > can tell, there is no mention of it in the CVS tree and I don't remember > getting any list mail about it. So what does everyone think? It'd be an > easy thing to add, from what I can tell... I spent some time reading the libmng docs a while back, and it does look fairly straight-forward to support; the one tricky bit would be getting the timing right. The library handles timing by letting you register a scheduler callback -- so you do something like: mng_register_scheduler(&schedule_callback); and when the animation calls for a 10ms pause, libmng will call schedule_callback(10, &mng_draw_some_more); and you're responsible for making sure that you call mng_draw_some_more 10ms later. (I don't remember the details, much less the actual function names, but this is the basic idea.) You give libmng control to do some drawing (and there's some mechanism to easily control what buffer it draws into, thank goodness), then after drawing one frame it gives control back to you, but first tells you when it needs control again. It's cute, and should work perfectly with event-loop based applications. For us, it's a little trickier -- the easy way to make this work is create a "animator" thread, that does nothing but sit around and drive libmng callbacks. Of course, proliferation of threads isn't a great idea, but I don't see a better way with our current architecture, unless we want to overload the thread doing event handling or something. Also, it'd be quite easy to generalize that thread to a general scheduler mechanism, and perhaps that's useful for things besides MNG support (can anyone think of any?). Overall, though, MNG support is a great idea, and that's the only tricky bit I forsee in implementing it. It's just that no-one's gotten around to doing it yet... want to have a go? ;-) -- Nathaniel -- Damn the Solar System. Bad light; planets too distant; pestered with comets; feeble contrivance; could make a better one myself. -- Lord Jeffrey This email may be read aloud.