Hey all,

Just found pyglet this week, and it beats the pants off pygame :-).  I
noticed some funny behavior when changing the anchor point on an image
and TextureBin. Consider the following snippets:

# Works
img = image.load('foo.png')
bin = TextureBin()
img_t = bin.add(img)
img_t.anchor_y = 10

# Throws GLError exception.  See end of message
img = image.load('foo.png')
img.anchor_y = 10
bin = TextureBin()
img_t = bin.add(img)  # Throws exception

Looking through the documentation, this isn't immediately obvious why
this is an error, though there is a hint under
pyglet.image.atlas.TextureAtlas ("This method will fail if the given
image cannot be transferred directly to a texture").  Is this behavior
correct?  I would expect the image to be blitted to the texture as
normal, and the TextureRegion to have the correct anchor value.  It's
not too big of a deal, seeing that I can just change the anchor of the
TextureRegion instead of the image, it just had me stumped for a
while.

Cheers,
Robbie

Here's the exception thrown:

Traceback (most recent call last):
  File "./test.py", line 11, in <module>
    img_t = bin.add(img)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/image/atlas.py", line 259, in add
    return atlas.add(img)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/image/atlas.py", line 207, in add
    self.texture.blit_into(img, x, y, 0)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/image/__init__.py", line 1598, in
blit_into
    source.blit_to_texture(self.target, self.level, x, y, z)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/image/__init__.py", line 948, in
blit_to_texture
    data)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/gl/lib.py", line 105, in errcheck
    raise GLException(msg)
pyglet.gl.lib.GLException: invalid value


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