We are developing a sample three.js application which shows a thumbnail. For any scene that we create, we require to take a screenshot of the canvas, for this purpose, we are using canvas.toDataURL("image/png"). For repeated invocations of the above function, it returns the same black image, despite elements being added to the canvas.
We are using WebGLRenderer and threejs r99
I am using google chrome and threejs. Since the canvas context will be made by threejs itself, I cannot add that parameter (preserveDrawingBuffer) shown in the question Canvas toDataURL() returns blank image only in Firefox
When you are calling WebGLRenderer
, pass preserveDrawingBuffer:true
. Here are list of parameters which you can configure.