Saving Sprites

36 views
Skip to first unread message

Steve

unread,
Jul 24, 2012, 12:31:01 PM7/24/12
to rab...@googlegroups.com
Sorry if this is a really dumb question, but is it possible to use Rabbyt to manipulate sprites and save the results to a bitmap rather than display on the screen?

Temia Eszteri

unread,
Jul 25, 2012, 11:24:33 PM7/25/12
to rab...@googlegroups.com
If you're using Pygame as the OpenGL context provider, the display
buffer can be treated as a normal Pygame surface, which includes being
able to save its contents to a file (see:
http://pygame.org/docs/ref/image.html).

Beyond that, I can't say for sure. I've been looking into porting
Allegro 5 to Python, which has more control over inter-image drawing
operations, but I haven't yet developed a working alpha to see how
well it plays with Rabbyt.

~Temia
--
Invective! Verb your expletive nouns!

Kiril Zvezdarov

unread,
Jul 25, 2012, 11:26:40 PM7/25/12
to rab...@googlegroups.com
Off the top of my head, I don't think it is possible. Rabbyt is purely
a rendering library, it does not even load images on its own - it uses
pyglet or pygame for that. But you can totally manipulate and save the
sprite texture with pyglet - straight from the Rabbyt Sprite object.
> --
> You received this message because you are subscribed to the Google Groups
> "Rabbyt" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rabbyt/-/w6Rhf39W2EcJ.
> To post to this group, send email to rab...@googlegroups.com.
> To unsubscribe from this group, send email to
> rabbyt+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rabbyt?hl=en.

Matthew Marshall

unread,
Jul 25, 2012, 11:33:11 PM7/25/12
to rab...@googlegroups.com
Rabbyt doesn't have any support for this directly, but it uses OpenGL
for drawing, so any way you can find to do this with OpenGL will work.

Using Pygame to read back the framebuffer like Temia mentioned should work.

If you don't want to write to the main framebuffer at all, you can
create an OpenGL "Framebuffer Object" (or FBO), render to the FBO,
then call glReadPixels to copy the data from the FBO to your bitmap.

MWM
Reply all
Reply to author
Forward
0 new messages