Alex Holkner wrote:
> On 12/5/07, Tony <[EMAIL PROTECTED]> wrote:
>   
>> Hi,
>>
>> I just started using pyglet after upgrading to Leopard OS X (before I
>> was using pygame). I'm trying to display (or animate) the values of a
>> numpy array (2D), but I haven't been able to figure out how.
>>     
> A more efficient way to draw the entire array is to copy it into a
> texture.  Use the pyglet.image.ImageData to create and update the data
> in a texture, which is then drawn using the blit() method.  If your
> numpy array is not in a format that ImageData can use, you can use the
> glTexSubImage2D call directly, with a little more effort.
>   
It seems a good idea to be able to create an Image without copying the 
data. As far as I can tell from a few minutes of browsing the code, this 
doesn't seem currently possible, as ImageData's _ensure_string_data() 
seems to allocate a new buffer each time. What are the prospects for 
making a code path that takes the raw data buffer, e.g. from numpy's 
my_array.ctypes.data (of course checking that the array properties are 
valid for a direct memory view, such as dimensions, strides, dtype, and 
so on)?

Can you give some hints as to what would be necessary to either A) 
modify ImageData to take a buffer object (or a view of numpy data, 
although this is more specific and less general) or B) create a 
ImageData-like class that would do something similar?

Thanks,
Andrew

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