Grabbing the Backbuffer or drawing to alternative.

Monkey Forums/Monkey Programming/Grabbing the Backbuffer or drawing to alternative.

BigAnd(Posted 2011) [#1]
I am looking for a way to either grab the backbuffer or draw to an off screen target. Having looked through the docs, I cant see any way of doing this yet.

GrabImage is what I used in Max but it does not work the same in monkey.

Reasons why I would want this:
My levels backgrounds are made up of 32x16 blocks, this means I am having to draw 512 sprites each frame. This is not counting the player and enemies. If I could draw these into a buffer at the start of each level, I could then just draw this buffer and then draw my player and enemies over the top (this is how I have done it in another language on the iPhone and it works well).

The iPhone and Android phones just aren't going to be able to do this many sprites each frame (I know, I have tried) but their fill rates are good enough to bang out a largish background image.

I could get around this by having all the backgrounds laid out on a large bitmap or all loaded separately on demand but this would be a nightmare when you have a hundred levels.

I am not sure on the technicalities of all this, as some of the platforms may not have persistent back buffers or be able to draw to an off screen buffer, so it might be hard to implement and make cross platform.

Sorry for the long post but has anybody got any thoughts on this?


marksibly(Posted 2011) [#2]
Hi,

Mojo does not support read/writing backbackbuffer or read/writing/rendering images.

You can probably hack around it for some targets, but it's unlikely to ever make it into Mojo as a standard feature.


BigAnd(Posted 2011) [#3]
Cheers Mark, that's what I was thinking.