- Hands-On Game Development with WebAssembly
- Rick Battagline
- 175字
- 2021-06-24 13:41:04
WebGL and JavaScript
As we learned in the previous chapter, working with the 2D canvas was pretty straightforward. To draw an image, you just need to translate the context to the pixel coordinates where you want to draw the image, and call the drawImage context function by passing in the image, its width, and its height. You could make this even simpler and forget about the translation passing the x and y coordinates directly into the drawImage function if you prefer. With the 2D canvas, you are working with images, but with WebGL, you are always working with 3D geometry, even when you are coding a 2D game. With WebGL, you will need to render textures onto geometry. You need to work with vertex buffers and texture coordinates. The vertex shader we wrote earlier takes 3D coordinate data and texture coordinates and passes those values onto a fragment shader that will interpolate between the geometry, and use a texture sampling function to retrieve the proper texture data to render pixels to the canvas.
- Windows phone 7.5 application development with F#
- 電腦軟硬件維修大全(實例精華版)
- SDL Game Development
- Effective STL中文版:50條有效使用STL的經(jīng)驗(雙色)
- Getting Started with Qt 5
- Manage Partitions with GParted How-to
- Mastering Manga Studio 5
- 微軟互聯(lián)網(wǎng)信息服務(wù)(IIS)最佳實踐 (微軟技術(shù)開發(fā)者叢書)
- Spring Cloud微服務(wù)架構(gòu)實戰(zhàn)
- Machine Learning Solutions
- Managing Data and Media in Microsoft Silverlight 4:A mashup of chapters from Packt's bestselling Silverlight books
- 基于PROTEUS的電路設(shè)計、仿真與制板
- Arduino項目案例:游戲開發(fā)
- 微控制器的應用
- Arduino案例實戰(zhàn)(卷Ⅳ)