On Wed, Sep 17, 2008 at 8:51 AM, Ragzouken <[EMAIL PROTECTED]> wrote:
>
> I just found out about these from this mailing list and read briefly
> about them from a PDF called 'Pyglet Programming Guide'. It seemed to
> me that I should be able to just drop /static etc at the end of my
> format strings like: 'v2i' -> 'v2i/static'. I tried that but it leads
> to me getting an error about slice assignment:
>
> File "/usr/lib/python2.5/site-packages/pyglet/graphics/__init__.py",
> line 348, in add
> vlist._set_attribute_data(i, array)
> File "/usr/lib/python2.5/site-packages/pyglet/graphics/
> vertexdomain.py", line 407, in _set_attribute_data
> region.array[:] = data
> ValueError: Can only assign sequence of same size
>
> Do I need to take special action when using static? My formats are
> like so:
> ('v2i/static', vertices),
> ('t3f', texcoords),
> ('c4B/static', colours)
I was able to reproduce this as well. It was in a more convoluted
application, so I boiled it down to a test case:
from pyglet.gl import *
import pyglet
window = pyglet.window.Window(100,100)
quad = pyglet.graphics.Batch()
quad.add(4, GL_QUADS, None,
('v3f/static', (0,0,0, 100,0,0,
100,100,0, 0,100,0)),
('t2f/stream', (0,0, 1,0, 1,1, 0,1)),
('c3f/static', (0,0,0, 1,0,0,
0,1,0, 0,0,1)))
@window.event
def on_draw():
window.clear()
quad.draw()
pyglet.app.run()
Specifically, these combinations cause the same slice error:
1)
v3f/static
t2f/stream
c3f/static
2)
v3f/static
t2f/stream
c3f/stream
3)
v3f/static
t2f/stream
c3f/static
4)
v3f/static
t2f/static
c3f/stream
5)
v3f/stream
t2f/static
c3f/stream
Other combinations cause no issues. The trend almost seems that if
there is a storage type difference between texture coords and any
other data, the error occurs. But the following combination does
*not* cause the problem:
v3f/stream
t2f/static
c3f/static
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---