- 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.
- 零點起飛學Xilinx FPG
- 用“芯”探核:龍芯派開發實戰
- 深入理解Spring Cloud與實戰
- Learning Cocos2d-x Game Development
- Applied Unsupervised Learning with R
- Creating Dynamic UI with Android Fragments
- 計算機應用與維護基礎教程
- 基于ARM的嵌入式系統和物聯網開發
- 從零開始學51單片機C語言
- Artificial Intelligence Business:How you can profit from AI
- 筆記本電腦維修不是事兒(第2版)
- 微服務分布式架構基礎與實戰:基于Spring Boot + Spring Cloud
- 單片機開發與典型工程項目實例詳解
- 無蘋果不生活:OS X Mountain Lion 隨身寶典
- 單片機原理與技能訓練