Hello, on a previous thread, I mentionned my unsuccessful attempts at making a cycling palette effect at a decent framerate (by generating all images at every steps in the palette shifting and using sprites).
I've looked at some OpenGL discussions on the subject and the most seen answer is to use a Fragment Shader that takes 2 Textures, one containing the palette (let's say my_palette) and the other containing the indexed map (in 'One Byte Per Pixel' format, for example GL_RED ; let's call it my_indexed_image), to compute the resulting output color (see http://www.opengl.org/wiki/Common_Mistakes#Paletted_textures). I've looked for examples of use of shaders with pyglet and managed to use simple ones, passing parameters through "uniform vecx". But, if I understood correctely (which may not be the case, it's my first insights in OpenGL, and documentation available on the net is often contradictory since it doesn't always concern the same versions of OpenGL), I must first create a texture with the indexed image in GL_RED format. I've tried something like that : image, palette = load_bmp('bridge.bmp') indexed_image = pyglet.image.ImageData(512, 512, 'R', image.flatten()) indexed_texture = indexed_image.get_texture() load_bmp is a custom fonction, reading an indexed bmp file and returning both image (a numpy.array with shape (512, 512), dtype = uint8) and palette (a numpy.array with shape (256, 4), dtype = uint8). But it does not work : Traceback (most recent call last): File "C:\Users\Tryphon\Documents\workspace\pyglet-shaders\demo\cycling.py", line 39, in <module> indexed_texture = indexed_image.get_texture() File "C:\Python27\lib\site-packages\pyglet\image\__init__.py", line 801, in get_texture force_rectangle) File "C:\Python27\lib\site-packages\pyglet\image\__init__.py", line 792, in create_texture self.anchor_x, self.anchor_y, 0, None) File "C:\Python27\lib\site-packages\pyglet\image\__init__.py", line 972, in blit_to_texture data) ctypes.ArgumentError: argument 9: <type 'exceptions.TypeError'>: wrong type Can someone point me what the problem is ? Thanks in advance ! -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/groups/opt_out.
