Fragment的概念

 

http://www.opengl.org/wiki/Fragment

 

Fragment 是Raster的输出,输出可以是color value, stencil value或者depth value,写几个OpenGL例子

 
 

Fragment is a collection of values produced by the Rasterizer. Each fragment represents a sample-sized segment of a rasterizedPrimitive. The size covered by a fragment is related to the pixel area, but rasterization can produce multiple fragments from the same triangle per-pixel, depending on various multisampling parameters and OpenGL state. There will be at least one fragment produced for every pixel area covered by the primitive being rasterized.

Fragments are processed in a manor similar to vertices in a Vertex Shader. An input vertex, build from Vertex Attributes defined duringVertex Specification, enters the Vertex Shader. After arbitrary processing, the vertex shader writes a number of values. These values represent the output vertex, and this output vertex is passed along to the next stages of the pipeline.

Fragments work the same way. An input fragment, built by the rasterizer, enters the Fragment Shader. After arbitrary processing, the fragment shader writes a number of values. These values represent the output fragment, and this output fragment is passed along to the next stage of the pipeline.

Fragment shader inputs

Initially, the data for a fragment consists of the following:

  • The screen-space position of the fragment, in the X, Y and Z.
  • A stencil value.
  • If point rasterization is being used, then there will be a location within the point for this fragment.
  • Arbitrary values written by the last vertex processing stage, which have been interpolated across the primitive's surface according to each variable's interpolation qualifiers.

Fragment shader outputs

After processing, the output fragment from a fragment shader consists of the following:

  • a depth value, either written by the fragment shader or passed through from the screen-space fragment's Z value.
  • a stencil value.
  • An array of zero or more color values, as written by the fragment shader.

The color value array elements are routed to different buffers based on the framebuffer's draw buffer state.

转载于:https://www.cnblogs.com/kylegui/p/3812871.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值