-
1. Re: Quick way to grab stage screenshot/framebuffer
_falcan0 Oct 8, 2014 10:47 AM (in response to _falcan0)Answering to myself, I managed to solve this after reading tons of tutorials and SO questions/answers
Basically you need to create your own texture-backed FBO inside the ANE. Inside the ANE you have the AIR's OpenGL context which is a good start.
Whenever you want to capture frames directly from AIR, you need to intercept AIR's rendering - you call into the ane on ENTER_FRAME event, bind your texture-backed FBO. Let AIR render into it (luckily AIR WON'T rebind it's own FBO if you present any FBO at least once, I don't know why exactly). So AIR renders happily into your texture-backed FBO, on next frame you can just access the data with glReadPixels or do even funkier things if you need to.
It is also possible to render this texture back to screen to "emulate" AIR's rendering because you loose it for a while, when capturing. You need to render a quad with this texture. It's also good to remember the FBO ID of AIR (before you bind your own) and when done with capturing bind AIR's FBO back so it can resume its normal rendering.
This is much faster than relying on BitmapData.draw and to deliver pixels into your ANE in general, especially for me as I"m also using texture caches so I dont even need to call glReadPixels which in itself isn't the fastest method around...

