In pyglet, I want to create an image buffer in memory, then set the bytes manually, then draw it. I tried making a 3x3 red square like this in my draw() function:
imageData = pyglet.image.ImageData(3, 3, 'RGB', [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 ])
imageData.blit(10, 10)
...but at runtime, Python complains:
ctypes.ArgumentError: argument 9: <type 'exceptions.TypeError'>: wrong type
Is this the right approach? Am I missing a step? How can I fix this?