O'Reilly logo

WebGL Game Development by Sumeet Arora

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 textures as model labels

In this section, we will discuss how we use dynamic textures to add labels to players in a game. In a multiplayer game environment, you may need to label your players with their usernames. Also, if you want to add stats overlay to your game, you can do it using two methods; either we use CSS overlays over our game canvas or use texture sprites and render it inside the canvas. If we plan to use the second method, we need a texture with text. Let's take a look at the following screenshot:

Adding 2D textures as model labels

In the preceding screenshot, we have a label Mr. Red placed on top of our model and a red bar denoting the remaining power in the ...

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