You are right, lots of objects with few vertices. I figured what you said
was the case. So, should I aggregate a huge list of triangle strip
vertices and push it to the batch all at once? By push I mean assign the
vertices directly, not using delete() and add(). I would need to set a flag
if any objects are created or destroyed, because then my number of vertices
will change and I will have to delete() and add(). Well, I could turn
destroyed polygons into degenerate vertices, and only delete()/add() on new
vertices being added. But then I worry that if I create this list then I
have to update the color and/or texture vertices for each polygon as well.
Or somehow keep the vertices in order so they don't float around on top of
the color/textures.
This is my first thought:
global vertexlist
verts = []
if not new: #the 'new' flag is set by space.add when a new polygon
was added to the space
for ob in l:
verts.append(ob.translate()) #translate returns degenerate
vertices if ob is dead
self.vertexlist.vertices = tuple(verts)
else:
cverts = [] #for colors
tverts = [] #for textures. I dont use texture verts now, will this
work?
for ob in l:
verts.append(ob.translate())
cverts.append(ob.colorverts)
tverts.append(ob.textureverts)
vertexlist.delete()
vertexlist =
Batch(len(verts)//2,GL_TRIANGLE_STRIP,None,('v2i/dynamic',verts),('c3b',cverts),(however
textures are))
Thanks. This seems reasonable. I'll give it a shot. If this is helpful
then I think I can tighten it up further.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.