HTML and CSS Reference
In-Depth Information
Sadly, you can't use 2D Canvas and the WebGL API in the same context. The trick to get-
ting around this is to use two <canvas> elements to create two different contexts and then
sit one on top of the other via CSS.
Step 2: Create style.css
Because creating text in WebGL isn't easy, you'll use text from HTML markup. We've in-
cluded in the previous index.html listing an introduction and starting screen, but it needs
some styling (see figure 9.4 ) .
Figure 9.4. Result of running the index.html file with CSS and HTML only. In the final screen, the triangular
player will appear between the words Geometry and Destroyer .
 
Search WWH ::




Custom Search