Hello. 
I have searched for a while and I can not quite find the solution to this 
issue I am having. Probably because I do not know what what I am looking 
for.

My issue is as follows:
I'd like to modify a primitive's vertex data after it has been added to a 
batch. I've tried modifying the list of vertex data every frame, but that 
only seems to directly modify the list. Everything added to the batch 
remains static for me.
I've tried changing the 'v2f' to 'v2f/stream,' but the batch draw seems to 
only draw what was added initially, disregarding any changes made to the 
vertex data after I have updated it with the vertices position attribute.

I am using pymunk and updating the position of the vertices to draw at 
every frame. It works with the straight pyglet.graphics.draw.

My code resembles the following:

> # Init add
> def __init__(self)
> self.box_verts = self.body_poly.get_points()
> self.vertlist = []
> for v in self.box_verts: # transforms a list of tuple coords 
> (Vec2d(x,y),Vec2d(x,y), etc) 
>          self.vertlist.append(v.x) # to a list that pyglet can draw to 
> [x,y, x,y, etc]
>          self.vertlist.append(v.y)
> self.player = batch.add(4, pyglet.gl.GL_POLYGON,
>                             ('v2f', (self.vertlist)),
>                             ('c3B', 
> (55,55,50,255,255,255,255,255,255,55,55,50))
>                             )
> #Update the vertices 
> def update(self, dt):
> self.box_verts = self.body_poly.get_points()
> self.vertlist = []
> for v in self.box_verts: # transforms a list of tuple coords 
> (Vec2d(x,y),Vec2d(x,y), etc) 
>         self.vertlist.append(v.x) # to a list that pyglet can draw to 
> [x,y, x,y, etc]
>         self.vertlist.append(v.y)
> self.newvertlist = self.vertlist.update()
> self.player.vertices = self.newvertlist
> def on_draw(self):
> self.clear()
> batch.draw()


I am using pymunk and updating the position of the vertices to draw at 
every frame. It works with the straight pyglet.graphics.draw.

If my problem does not make sense please let me know and I will attempt to 
clarify.

Thank you for your time and patience.

-- 
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.


Reply via email to