2012-10-31 23:43:05| 分类: 3D reconstructio | 标签: |举报 |字号大中小 订阅
1 concepts
片段处理器用于进行纹理访问、纹理混合、雾化等操作。The fragment shader is run for every pixel on the screen where the polygons of the mesh appear. It is responsible for setting the final color of the little piece of the mesh.
// Fragment Shader
void main()
{
gl_FragColor = vec4(1, 0, 0, 1);
}
2 Attributes
(1) texture2DProj
Use the texture coordinate coord to do a texture lookup in the 2D texture currently bound to sampler. The texture coordinate (coord.s, coord.t) is divided by the last component of coord. The third component of coord is ignored for the vec4 coord variant.
tex2DProj 函数与 tex2D 函数的区别就在于:前者会对齐次纹理坐标除以最后一个分量 q ,然后再进行纹理检索!
评论