I found one more of my appalling mistakes - I wasn't adding '\static'
on to the descriptors of my vertex location and color arrays when
creating my vertex_lists and batches.
eg. my batch creation now looks like:
self.batch = Batch()
for primitive in self.primitives:
numflatverts = len(primitive.flatverts) / 2
self.batch.add(
numflatverts,
primitive.primtype,
None,
('v2f/static', primitive.flatverts),
('c3B/static', primitive.color * numflatverts)
)
I'm on different hardware than above (now at work, shhhhh!), a Windows
desktop machine, with the same geometry as before, which has gone from
speeds like this:
glvertex: 35fps
draw: 15fps
vertex_list: 17fps
batch: 35fps
To speeds like this (with '/static' added):
glvertex: 35fps (no code changed)
draw: 15fps (code change has no effect)
vertex_list: 32fps (yay!)
batch: 60fps+ (yay!)
Only outstanding mystery is now why pyglet.draw() is slower that
calling glVertex(). I'll chase this up tonight...
On Sep 16, 10:51 am, Tartley <[EMAIL PROTECTED]> wrote:
> Hang on. I'm beginning to feel that, with all due respect, I don't
> understand how Alex's answer can be right.
>
> One frame every five seconds using vertex lists can't be because of
> the modest overheads of using a batch.
>
> There must be something else. I'll continue my investigations tonight,
> report it here for future googlers if I figure it out.
>
> Jonathan
>
> On Sep 16, 9:54 am, Tartley <[EMAIL PROTECTED]> wrote:
>
> > Let me try that last response again. It's too early in the morning for
> > me to post precisely enough.
>
> > For creatures I'll try as you say, and for the world in the background
> > I'll use a batch with static vertices.
>
> > Thanks heaps Alex!
>
> > On Sep 16, 9:46 am, Tartley <[EMAIL PROTECTED]> wrote:
>
> > > Thanks heaps for the response.
>
> > > I see, thanks, that makes sense.
>
> > > Maybe for creatures I'll do as you say then, and maybe for entities
> > > with more vertices (like drawing the world in the background) I'll try
> > > using a batch for that.
>
> > > Is the same sort of issue true for the 'graphics.draw' call, or is
> > > that likely to be some other blunder on my part?
>
> > > On Sep 16, 2:18 am, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
>
> > > > On 9/16/08, Tartley <[EMAIL PROTECTED]> wrote:
>
> > > > > Alright, I fixed the wonky graphics I was seeing on batches due to
> > > > > the
> > > > > problem above, but I still have a performance problem that I can't
> > > > > figure yet.
>
> > > > > When drawing using glVertex I see about 30fps.
> > > > > Using graphics.draw, I get about 12fps.
> > > > > Using graphics.vertex_list, I get 1 frame every 5 seconds
> > > > > Using graphics.batch, I get 1 frame per second.
>
> > > > [snip]
>
> > > > You haven't got enough geometry to overcome the (modest) overhead of
> > > > drawing abatch. 43 vertices probably won't even fill the pipe by the
> > > > time they're finished, so there's no benefit in reading them from
> > > > memory faster (which is whatbatchgives you).
>
> > > > You can probably get a speedup from the immediate mode rendering if
> > > > you add all the creatures into the samebatch, and (re)calculate their
> > > > positions and orientations using python sin/cos yourself instead of
> > > > glTranslate/glRotate etc.
>
> > > > Alex.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---