terrymisu

  • Apr 15, 2013
  • Joined Feb 21, 2013
  • At Pycon this year, Eben Upton made a call for graphics demos for the Pi to really showcase its potential.

    I'd love to get the Spine runtime working smoothly on the Raspberry Pi.

    It works with pyguts/spine-python, but I'm only getting about 4.5-5.5 frames per second. I've narrowed this down to pygame simply providing really awful performance on the Pi, and it's probably due to everything being software rendered.

    Pygame has OpenGL hooks, but the Raspberry Pi uses OpenGL ES, so I'm fairly certain that Pygame isn't able to hardware accelerate the drawing calls on the Pi.

    Eben did mention to me that they're planning on looking at optimizing Pygame on the Pi at some point, but he also mentioned that the OpenGL layer on the Raspberry Pi should be blazingly fast. I'll probably follow up with the foundation and let them know what I've discovered.

    So over the weekend I hacked on my Pi and got a Python library called "pogles" installed and was able to run the test application that comes with it, which draws a red triangle on the screen.

    I'll probably look for some more examples that layer on top of pogles, with and end goal of getting spine-python working with OpenGL hardware acceleration on the Raspberry Pi.

    If anyone else has an interest in helping let me know.

  • I finally fixed the last rendering issue with spine-python.

    The latest bits are up on github/pypi. ๐Ÿ™‚

  • The Corona runtime does this already, so you can probably look there to get an idea of what's supposed to happen.

    Look in main.lua.

  • Nate wrote

    Something is wrong with your rotation. The arm shouldn't snap around like that. Note sure exactly what it could be...

    Ok, I've finally dug into this a bit more.

    I think that less than 30 frames of my animation are being drawn, but I'm not sure why.

    I've got an animation with 120 frames. Only part of the animation ever draws with the Python, so this is what made me start thinking that this bug may be related to the # of frames.

    Sure enough, I can cause a snapping arm movement with Spineboy by looping @ < 30 FPS.

    Here's what my sword example should look like:

    http://youtu.be/06wn68e0D7M

    Here's what it actually looks like:

    http://youtu.be/mKPTzDb4P8g

    Seems like it might be timeline related, or maybe it's an issue with the values I'm passing to apply? What do you think?

    [Edit] In case it's not obvious, the Spine recording wasn't playing from frame 0, but I recorded enough of the video playing for you to see the animation start over @ 0... sorry about that.

  • I have updated spine-python to take advantage of the new format. All of the examples for pyguts have also been updated.

    There are tarballs on pypi.org and source on github (search for spine-python).

    Cheers ๐Ÿ™‚

  • May I suggest putting links to the Trello pages in place of the change log for folks who go looking for it?

    I find myself having to dig for the URLs every time I am curious what's happening next... just a thought.

  • Yeah, I did that...

    I stepped through with spacebar incrementing the animation time by 1 each time, and it sort of looks like his arm gets to key frame 20, and then snaps back to key frame 0 (or 32?), but that doesn't make sense to me.

  • Ahhh... duh.

    Since scale and smoothscale take width, height I can multiply the scale by those... ๐Ÿ˜‰

    Looks like I got it working.

  • Nate wrote

    Haha rotation is a little messed up, but nice sword! ๐Ÿ˜ƒ

    If your game toolkit can't draw quadrilaterals, then you should only use uniform scaling (equal x and y) in Spine. This is the case with Corona. You can actually use non-uniform scaling even if the game toolkit can't draw quads, but you have to align your images with the bone so that the images don't get squashed to a rhomboid (diamond) shape when the bone is scaled non-uniformly.

    Ok, I'm ready to tackle this.

    I can scale by integer values for both x, and y, but I can't scale the x and y separately with floats.

    I can scale equal x and y with floats.

    What's the best way to implement this? The images have float-value scaleX/scaleY, so it isn't apparent to me how to make this work, given the APIs I have available to me.

    Here's the pygame documentation on transformations, for reference... maybe there's something in there that I'm not seeing.

    http://www.pygame.org/docs/ref/transform.html

    rotozoom will take a single scale value (float).

    scale, and smoothscale will take an integer for the width/height of the new image, but not float.

  • I sort of figured the problem out.

    My scaling code is broken. I turned it off for now, and I had to add some extra logic to figure out how to flip the image. Pygame isn't very smart. :/

    I think I have everything working except scaling.

  • I have the dragon example running. There were some Atlas loading problems that would prevent atlases with more than 1 sprite sheet to fail to load.

    I also fixed some bugs related to importing skeleton data and animation when certain keys were missing from the JSON files.

    The latest code is up on github, and pypi.python.org.

  • Nate wrote

    Cool, thanks! ๐Ÿ™‚ Too bad it crashed though, lame. ๐Ÿ™

    I posted my crash log on github.

  • Some posts were lost due to some sort of server issues. There's a post on the forum talking about it.