Jump to content

[Solved]toDataURl Work in PlayGround but the result(.zip file not work)


NasimiAsl
 Share

Recommended Posts

Hmm.

Injecting the non-PG version, I see an encoded image is created, although it doesn't look right. It's just grey, and does not change based on camera rotation or position.

The second issue is that, neither setting the image.src or image.setAttribute('src',...) seem to work. The src is changed, but not updated.

Link to comment
Share on other sites

Ahh. This one worked:

https://stackoverflow.com/questions/26783586/canvas-todataurl-returns-blank-image-only-in-firefox

var engine = new BABYLON.Engine(canvas, true);
var captureFrame = false;

.................
......................
.................


clickii = function(){
            captureFrame = true;
}


.................
......................
.................


engine.runRenderLoop(function () {
            scene.render();
            if (captureFrame) {
                var im  = document.getElementById("test1");
                im.src = canvas.toDataURL();
                captureFrame = false;
            }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...