On 9/10/08, josch <[EMAIL PROTECTED]> wrote:
>
>  hello again!
>
>  on my long travel to deeper pyglet knowledge i now tried to do as you
>  guys said and now use batches without creating sprites but by just
>  adding vertex and texture data to my batch.
>  here you can see my current demo code that oulines how i understand it
>  up to now: http://phpfi.com/352024
>
>  please correct me where I'm wrong but let me just shortly explain what
>  my understanding is about what the code does up to now:
>  upon creating the window my tile resource is loaded (despite the pcx
>  extension this is a png image). the resource module automagically adds
>  this to a TextureBin which manages a series of TextureAtlas'es which
>  itself stores images in one big texture. The resource will return a
>  TextureRegion that describes the placement of my image in this
>  TextureAtlas so i can access it in there.
>  next i set some lists and fill them once - this will be done later in
>  a loop to add more than one tile.
>  the vertex_data contains the coordinates of each square's corners on
>  the screen as four x/y coordinates.
>  the texture data stores the texture coordinates of my image in the
>  TextureAtlas.
>  the color_data stores the color of each of my tile's corner. this will
>  probably be overwritten by my texture.

Actually the vertex colours will scale the texture colour; effectively
tinting it.  Usually the colour needs to be white, which you've done.

>  then i add those four "corners" of my tile with their respective
>  coordinates and colors to the batch as a GL_QUAD.
>  the batch is then drawn in the on_draw() method
>
>  unfortunately my texture will not show up so a hint on what i'm still
>  doing wrong is very much appreciated.

Just need to enable texturing and bind the texture.  Ideally you would
do this in the group, so you can use different textures within the
same batch; but for now you can just add it where your blend state is
set.

glEnable(self.tile.target)
glBindTexture(self.tile.target, self.tile.id)

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

Reply via email to