Error #3692: All buffers need to be cleared every frame before drawing
So I have this Starling project and wanted to take a screenshot of the Stage3D currently in use.
I was trying to use the Context3D.drawToBitmapData() function and kept getting this error:
“Error #3692: All buffers need to be cleared every frame before drawing.”
Googling around yielded no results, so after figuring out the problem I’m posting the solution here for anyone else having this problem.
The solution is short: you have to call drawToBitmapData() BEFORE the Context3D.present() call.
In my case with Starling I had to add the functionality in the Starling.render() function, between the call to mStage.render() and the call to mContext.present().
Tags: 3692, bitmap, bitmapdata, buffer, buffers, context3d, error, screenshot, Starling
November 20th, 2012 at 10:35
I just came across this problem too, trying to do the same thing in Alternativa3D using Context3D.drawToBitmapData. After a little head scratching (and looking at Alternativa3D sources) I found the renderToBitmap property of “alternativa.engine3d.core.View” which lets you output camera render to BitmapData, e.g.
import alternativa.engine3d.core.Camera3D;
…
private var _camera:Camera3D;
….
public function getScreenGrabBitmapData() : BitmapData
{
_camera.view.renderToBitmap = true;
_camera.render(_stage3D);
var bitmapData:BitmapData = _camera.view.canvas.clone();
_camera.view.renderToBitmap = false;
return bitmapData;
}
April 16th, 2013 at 22:14
Thank You, it works to solve my problem :D