On Wed, Mar 5, 2008 at 9:29 AM, Serg Kovrov <[EMAIL PROTECTED]> wrote:
>
>  I am very much for the new (1.1) style of main loop. Actually I do a
>  hybrid way - 'schedule' update routine when there is something to
>  update, and 'unschedule' when no tasks left to update.
>
>  The only problem is, for complex objects like particle systems,
>  separation of 'update' and 'draw' routines is hurting performance. In
>  case of particle it would be better to update each particle state and
>  draw it in place. I can't do it in 'on draw' handler, because I need
>  to know the time delta.

Are on_update and on_draw functions or rather methods on a class?  Can
you not store the time delta as a property on the class?

>  I guess I can workaround it by storing time delta globally on update
>  to use it in draw routines, but this does not feels natural.
>

Do what works first and then make it feel natural later ... ;)

Regarding the performance issues, my first guess is that you have
update and draw function per particle in the system - because the
addition of 1 function call cannot hurt performance but N/2 vs. N
functional calls is a significant optimization.  If my wild guess is
true, then consider putting all your particles in one class
(ParticleSystem) so you have at most 2 function calls per particle
system (unless you make calls to change their positions - I hope not).
 I have more guesses ... but that would lead us to a game of charades.

Anyhow, please post some code, so someone can perhaps point out where
the bottleneck is.

Cheers,
-- 
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/  \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\  /\\\ \\
/ /\\\  /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
               d.p.s

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to