InfoBox into canvas - on context webgl

You can add a infobox within the canvas or using context webgl? Because you need to use the method (canvas toDataURL) to take a customer's screen printscreen. Thank you.

Sorry, there’s nothing built into Cesium to handle this.


This is a limitation of browser technology, in general. It’s basically impossible to do what you want on the client side, whether your using Cesium or not, you would need a browser plug-in to handle it.

You can not add text on the canvas from a context webgl? whereas it is in the own domain?

the same way that adds a billboard?

You can add text on a canvas, but you can’t draw rendered HTML elements to a canvas, which is what the InfoBox is (and what you originally asked to do). You also can’t mix 3D and 2D contexts, which means everything has to be done in WebGL in order for toDataURL to access it.

To do what you want you would have to disable the default infobox and implement your own version that draws whatever you want to a canvas each frame and then uses a ViewportQuad to render it as part of the webGL scene. How the description information gets to the canvas is entirely up to you, but you would have to parse any HTML yourself (which is a ton of work and virtually impossible) or limit yourself to text only.

For these reasons, there’s no good way for us to support what you are asking for out of the box.

While it would be great for browsers to allow for JavaScript generated screenshots, the security issues means it will never happen.

I’ll just leave this here:

But if your goal is to let the user print the Cesium scene with the info box, using the browser’s built in printing capability plus a print stylesheet is likely to work out a lot better.