by implementing my own blit_to_texture, leaving out everything that
isn't necessary on my setup (I always have RGBA data and want to use
glTexSubImage2D) i got some minor improvements that aren't worth the
effort in modifying this method - i get still around 4fps.
the real culprit is the _convert() section i that i replaced with the
code that is actually executed on my system.
a lot of nasty regex and string operations :(
(apparently the image data is turned upside down and not a string but
a list object so this has to be corrected)

imagedata = obj.next_frame()

data_pitch = abs(imagedata._current_pitch)

# Workaround: don't use GL_UNPACK_ROW_LENGTH
if pyglet.gl.current_context._workaround_unpack_row_length:
    data_pitch = imagedata.width * 4

###### start costly
imagedata._ensure_string_data()
data = imagedata._current_data
rows = re.findall('.' * abs(data_pitch), data, re.DOTALL)
rows.reverse()
data = ''.join(rows)
###### end costly

if data_pitch & 0x1:
    alignment = 1
elif data_pitch & 0x2:
    alignment = 2
else:
    alignment = 4
row_length = data_pitch / 4
pyglet.gl.glPushClientAttrib(pyglet.gl.GL_CLIENT_PIXEL_STORE_BIT)
pyglet.gl.glPixelStorei(pyglet.gl.GL_UNPACK_ALIGNMENT, alignment)
pyglet.gl.glPixelStorei(pyglet.gl.GL_UNPACK_ROW_LENGTH, row_length)

pyglet.gl.glTexSubImage2D(obj.tex.owner.target, obj.tex.owner.level,
                    obj.tex.x, obj.tex.y,
                    imagedata.width, imagedata.height,
                    pyglet.gl.GL_RGB, pyglet.gl.GL_UNSIGNED_BYTE,
                    data)
pyglet.gl.glPopClientAttrib()

# Flush image upload before data get GC'd.
pyglet.gl.glFlush()

of course i could prepare my images so that they dont have to be
converted in the first place on every blit.
but even when i leave out the convert code (displaying map objects
upside down) i only get around 18fps while only doing 120blits every
1/6 second so even blitting seems slow.
original fps without animation is 55.
maybe i should try my code on other hardware the next few days...
--~--~---------~--~----~------------~-------~--~----~
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