O'Reilly logo

Three.js Essentials by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding 2D information using HTML canvas as a texture

So far, we've just used the basic features of Three.js to render the globe. In this section, we'll look a bit further and use this globe as a way to visualize data. We'll show you how you can use an HTML5 canvas as a texture to visualize data on the 3D globe. What we're aiming for in this section is shown in the following screenshot (the 02.06-canvas-overlay.html file):

Adding 2D information using HTML canvas as a texture

All the red circles that you see in this screenshot are ports, and they are shown on the rotating globe. To get this result, we first have to get a source for the data. For this, I've used the World Port Index (WPI) database that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required