gl ,shader笔记

来源:互联网 发布:和男友逛街知乎 编辑:程序博客网 时间:2024/04/30 07:42

 Stencil Buffer
One use for the stencil buffer is to restrict drawing to certain portions of the screen,
 
  就好象对纸喷漆的时候 先加上一个有格的挡版
这样的话, 喷上的漆在没有遮拦的地方就对纸上了色。有遮拦的地方就上到挡版上了
 

Scissor Test
You can define a rectangular portion of your window and restrict drawing to take place within it by using the glScissor() command. If a fragment lies inside the
rectangle
 
Alpha Test
In RGBA mode, the alpha test allows you to accept or reject a fragment based on its alpha value.
 
  Stencil Test
The stencil test takes place only if there is a stencil buffer. (If there is no stencil buffer, the stencil test always passes.) Stenciling applies a test that compares a
reference value with the value stored at a pixel in the stencil buffer. Depending on the result of the test, the value in the stencil buffer is modified. You can
choose the particular comparison function used, the reference value, and the modification performed with the glStencilFunc() and glStencilOp() commands.

Depth Test
For each pixel on the screen, the depth buffer keeps track of the distance between the viewpoint and the object occupying that pixel. Then if the specified depth
test passes, the incoming depth value replaces the one already in the depth buffer.
 
 
 景深模糊的功能可以通过
Depth of field 来实现
通过不断调整 细微投射坐标 然后设置glAccum (GL_ACCUM, 0.125); 来缓慢衰减颜色就可以。。更可以用来做细微的soft shadow

The OpenGL Shading Language and its supporting OpenGL API entry points allows application developers to define the processing that occurs at key points in the OpenGL processing pipeline by using a high-level programming language specifically designed for this purpose. These key points in the pipeline are defined to be programmable in order to give developers 

  vertex shader 构线,影射之前
fragment shader 光栅化,付上材质之后

  Applications can provide attribute values between calls to glBegin and glEnd or with vertex array calls, so they can change as often as every vertex.
 vertex shader 处理的是 begin .... end之间的
数据 换句话说 。。不是全部load到 内存中的点数据而是要执行的点的数据

UNIFORM VARIABLES pass data values from the application to either the vertex processor or the fragment processor.

其实就是诸如 view matrix  projection matrix 之类的算子 

Variables that define data that is passed from the vertex processor to the fragment processor are called VARYING VARIABLES. 
 

The fragment processor usually performs traditional graphics operations such as the following:

Operations on interpolated values

Texture access

Texture application

Fog

Color sum

 
已经在 光 点 算之后了  这里算材质 和插值

vertex shader 主要做光
fragment shader 主要做各种泛化的处理