Jump to content

Blank screenshots


styxxx
 Share

Recommended Posts

Hi,

I'm getting blank screenshots only, meaning: a PNG with full transparency. The size is correct though.
 

//Somewhere a scene is loaded 
var scene = null;
BABYLON.SceneLoader.Load('', 'data/data.babylon', engine, function(newScene){
    scene = newScene;
// some stuff 
}

//Some features like camera, lights are added... 

// Finally somwhere the render loop
engine.runRenderLoop(function(){
      scene.render();
});
      

// and then manually in the js console or via events the screenshot command is triggered:
BABYLON.Tools.CreateScreenshot(scene.getEngine(),scene.activeCamera, {"precision": "1"});

I tried tracing the steps this function does in the babylon.tools.ts and entered the necessary commands into the javascript console:

 

 var screenshotCanvas;

 if (!screenshotCanvas) {
          screenshotCanvas = document.createElement('canvas');
}
            
screenshotCanvas.width = 630;  
screenshotCanvas.height = 1366;

// checked here and screenshotCanvas is set to '<canvas width=... height=... >'

var renderContext = screenshotCanvas.getContext("2d");

renderContext.drawImage(engine.getRenderingCanvas(), 0, 0, 1366, 630);
// engine.getRenderingCanvas() returns '<canvas class=".." id=".." width="1366" height="630" >'
// it's the correct babylon canvas 

//Then I checked via 
renderContext.getImageData(400,300,200,1); // (random values)
//if there was any value set to anything else then 0. But no, all the values are 0. 


For some reason there is no image drawn at renderContext.dawImage().
screenshotCanvas remains blank and I only receive the blank png

engine is set (I also used scene.getEngine()), scene is set too (and has a lot of data). So is scene.activeCamera.
There are no error messages. 

This looks like a bug. Although I can't get my head around it. 


Unfortunately I can't post the whole code since it's work related (and mostly done by a third party company). Would be way too large I guess. But as far as I can tell there's nothing that would explain it. The scene is used to render everything. 

Babylon v.2.5 is used. 
And chrome/chromium (the final product will use the chromium embedded framework to display the webgl animation within an native application)

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...