away3d / away3d-core-fp11

Away3D engine for Flash Player 11
http://www.away3d.com
Other
639 stars 273 forks source link

queueSnapshot does not work on multiply views #714

Open 62316e opened 9 years ago

62316e commented 9 years ago

Hi,

RendererBase.as

if (!_shareContext) {
                if (_snapshotRequired && _snapshotBitmapData) {
                    _context.drawToBitmapData(_snapshotBitmapData);
                    _snapshotRequired = false;
                }
            }
62316e commented 9 years ago

Fixed by adding same code into Stage3DProxy.as::onEnterFrame method if (_snapshotRequired && _snapshotBitmapData) { _context3D.drawToBitmapData(_snapshotBitmapData); _snapshotRequired = false; }

bknill commented 9 years ago

I'm having the same issue. Did you need to add the whole queueSnapshot function to Stage3dProxy as well? Or should it still be called by the renderer?

bknill commented 9 years ago

I did and got 'Error: Error #3692: All buffers need to be cleared every frame before drawing.'

62316e commented 9 years ago

Thats my Stage3DProxy.as

private function onEnterFrame(event:Event):void { if (!_context3D) return;

        // Clear the stage3D instance
        clear();

        //notify the enterframe listeners
        notifyEnterFrame();

        if (_snapshotRequired && _snapshotBitmapData)
        {
            _context3D.drawToBitmapData(_snapshotBitmapData);
            _snapshotRequired = false;
            dispatchEvent(new Event("snapshotReady"));
        }
        // Call the present() to render the frame
        present();

        //notify the exitframe listeners
        notifyExitFrame();

    }
bknill commented 9 years ago

Oh thanks. Yeah I had the call after present();

What's listening for 'snapshotReady' ?

62316e commented 9 years ago

I made 'snapshotReady' for project purpose .

_stageView.stage3DProxy1.addEventListener("snapshotReady", onSnapshotReady); _stageView.stage3DProxy1.queueSnapshot(bmpSnapshot);

You just have to wait for a next frame (eg present)

bknill commented 9 years ago

Thanks.

It's coming back black, I'll have to work out why it's empty.