tags:

views:

27

answers:

1

Is there a way to set individual pixel values for image data in Pyglet?

I guess it can also be done by setting the OpenGL rendering mode to points, so if someone has insight on this, please share it as well.

+1  A: 

The following is purely from an OpenGL standpoint, I don't know of any pyglet tricks for this.

There is always glDrawPixels, or you could use an OpenGL texture that is the same resolution as your window (best if you can use non power of two texture sizes) and then map that texture on to a quad that takes up the entire window.

The latter I think is the fastest solution for when you don't have to change pixels on every refresh because all the data is already on the card.

You can keep a "local" (in cpu memory) cache of the texture data for easy modification and re-uploading. Or, for bonus points, you can modify the texture data directly via OpenCL ;)

Toni Ruža
This is a good answer, thanks. Only, I would prefer not to wade in the unfriendly OpenGL waters if I don't have to .. :)
kaloyan