It seems wasteful to draw all of the sprites every single time on_draw is 
called. Sometimes there are a few hundred elements on display, but most of 
them stay static for a long time. There must be a more efficient solution 
than that.

On Tuesday, April 21, 2015 at 3:28:33 PM UTC-4, Adam wrote:
>
> On 21/04/15 16:57, pyglet_has_bugs wrote: 
> > Redrawing every image in my application in every call of on_draw takes 
> > too much time, so I updated my code to work the following way: 
> > 
> > Every time an image is modified, it is added to a queue. Every time 
> > on_draw is called, it iterates through the queue and draws each image. 
> > When the application loads, every image is added to the queue. 
> > window.clear() is never called. 
> > 
> > For some reason, the application keeps oscillating as I use it. After 
> > one update to one image, half of the displayed images vanish. After 
> > one more update to an image, all of the vanished images reappear, and 
> > the other half of them vanish. After one more update, all of the 
> > displayed images vanish, and the other half reappear again. I put 
> > print statements in the method that draws images, and it is only 
> > drawing one image every time I update an image. This implies to me 
> > that there are perhaps multiple graphics windows being drawn to. 
> > 
> > Any suggestions for where to look to fix this problem? 
> > 
> I would suggest you create sprites and use a batch to draw them all at 
> once. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to