markdown WebGL:关于光栅化引擎的个人备忘录和注释。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown WebGL:关于光栅化引擎的个人备忘录和注释。相关的知识,希望对你有一定的参考价值。

# WebGL

### Basic facts
WebGL runs on the GPU on your computer.
Vertex shader and a fragment shader and they are each written in a very strictly typed C/C++ like language called GLSL (GL Shader Language).
Paired together they are called a program.

### Sending data
There are 4 ways a shader can receive data.
* Attributes and Buffers
* Uniforms : Data are passed to the shader that stay the same for all vertices in a draw call.
* Textures : Data from pixels/texels.
* Varyings : Data passed from the vertex shader and interpolated.

A Vertex shader which provides the clipspace coordinates and a fragment shader that provides the color.
The majority of the WebGL API is about setting up state to supply data to our GLSL programs

### Rendering
In progress

### Keyswords
* attribute
* uniform
* precision medium
* varying

### Notes
* Clipspace coordinates always go from -1 to +1 no matter what size your canvas is
* Colors in WebGL go from 0 to 1.
* You should always set the size you want a canvas with CSS.

### Acknowledgements
Based on the following websites/blog posts :
* [webglfundamentals.org](https://webglfundamentals.org/webgl/lessons/webgl-fundamentals.html)

以上是关于markdown WebGL:关于光栅化引擎的个人备忘录和注释。的主要内容,如果未能解决你的问题,请参考以下文章

WebGL-四

WebGL 单通道wireframe渲染

光栅化:一种实际的实现

WebGL-五

WebGL简易教程:颜色

webgl 系列 —— 渐变三角形