oups... after pyweek's end of course... ^^ my bad... :D
i will try out some other things in the train tomorrow.
besides the problem that i found no way to switch the texture in my
vertex list besides calling batch.add() again there is another issue
that tiles with transparency do not get transparent despite
pyglet.gl.glEnable(pyglet.gl.GL_BLEND)
pyglet.gl.glBlendFunc(pyglet.gl.GL_SRC_ALPHA,
pyglet.gl.GL_ONE_MINUS_SRC_ALPHA)
beeing set. the mouse cursor renders fine with transparency too.
i will have a look at those tomorrow and hope that i find anything
useful from the make me and cocos2d source.
any suggestions on sourcecode that dynamically draws multiple textures
on the screen without calling batch.add() ?
if possible i would like to create my vertex list only once (and on
resize of course) with batch.add() and after that only manipulate the
returned vertex lists while also beeing able to dynamically swap the
textures used in each vertex list.
so nice pyweek everybody! i hope there is much new educational code
for me to read!
On Sep 13, 5:03 pm, josch <[EMAIL PROTECTED]> wrote:
> I do have all frames of the same animation in the same texture.
> The problem arises when doing movements by just swapping the texture
> coordinates.
> say i have a 1x2 array of vertex lists. one is the water animation and
> one is a static terrain tile.
> i animate this by switching the textureregion of the water tile and i
> move the scene by doing the same.
> but when i want to draw the static terrain in the same vertex lists
> where the animated water once was it is not enough to just switch the
> vertex list's texture region. this will just fail and display junk.
> my solution is to delete my two vertex lists with the water and the
> static terrain, and create new ones by adding them to the batch in
> their new positions.
> i seem to lack a bit understanding here and hope you get what i want
> to do.
> in case this is not clear here is the code i use for
> now:http://phpfi.com/352930
> the vertex_list list is created with several batch.add() for each tile
> that are to be drawn on the screen.
> for movement it is then only moved max. 32 px in each direction. after
> that it is drawn at its original position and the textureregions are
> swapped.
> i hope you find some free time for this after pygame's end :)
>
> On Sep 13, 2:25 pm, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
>
> > On 9/13/08, josch <[EMAIL PROTECTED]> wrote:
>
> > > As all begins to get bigger I need some additional advice.
> > > For my viewport I manage vertext lists that i only need to modify in
> > > their texture or coordinates to move around the map or do animations.
> > > I only need to delete them and create new vertex lists with
> > > batch.add() when the window is being resized.
> > > the rest of the time i only access the vertex lists and modify their
> > > parameters (tex_coords and vertices).
> > > this is quite fast but the problem comes in when i need more than one
> > > texture to draw my map because i can no longer simply swap the
> > > textureregion when moving and animating as eventually the texture
> > > itself has to change too.
> > > as i understand it now i have to do a batch.add() again to attach a
> > > TextureGroup that will do this for me.
> > > again this works fine but calling batch.add() for every movement is
> > > MUCH slower than just switching out the textureregions as i did
> > > before.
> > > any ideas on that?
>
> > You can actually migrate a vertex list from one group to another, but
> > this has a similar performance penalty. Ideally you would keep frames
> > of an animation in a single texture; vertices can then keep their
> > group. There's no problem with having multiple groups in a batch;
> > this is actually quite an efficient way of managing the drawing of
> > several textures.
>
> > 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
-~----------~----~----~----~------~----~------~--~---