OpenGL pipeline (very important)
1 modeling:?
1.1 將OpenGL配置到應用程序中;
1.2 設置 graphic context,如讀入要進行貼圖的紋理,設置要投影的模式(glfrustum),light source, material;
2 vertex processing
2.1 transformation,將vertex從 local space變到eye space
2.2 為定點進行lighting computation
2.3 計算vertex的texture coordinate
2.4 texture coordinate transformation
3
3.1 primitive assembly: 哪幾個vertex屬于同一個polygon
3.2 clipping, 將在eye space中的object與第一步modeling中設置的frustum進行切割,并將切割的結果,即frustum里頭的object, 進行perspective division,即將frustum壓縮到2*2*2的Cube里頭
3.3 將cube里的object變換到window/screen space中, 即用glviewport 設置結果要在window的哪個地方顯示
3.4 back culling
4 rasterization
4.1 rasterize 面對eye 的object的polygon,因為在3.4中back culling,已將所有背對eye的面去除;
?
5 fragment processing
5.1 通過對vertex進行差值,得到每一個fragment的顏色(光源提供給每個fragment的亮度,只有頂點進行了lighting computation,這是OpenGL默認的,如果想顏色的過渡更細膩,可以分割polygon,這樣vertex就多了);
5.2 通過vertex的紋理坐標,即在紋理中的位置,對fragment進行坐標差值,確定fragment對應的紋理的位置,然后讀取紋理值;
?
6 per-fragment operation
各種測試(alpha, depth etc),不通過測試的fragment直接丟棄,這也是為什么叫fragment為potential pixel的原因,只有通過測試的fragment才能在屏幕上顯示成為pixel。其實pixel的本質是面積很小的cube,但是為了方便理解,我們一般認為它是點;
7 frame buffer
?
第2步vertex processing和第4步fragment processing可以再編程,即自己寫shader代替編譯器的相應部分。
?
?
?
?
?
轉載于:https://www.cnblogs.com/qingsunny/p/3304655.html
總結
以上是生活随笔為你收集整理的OpenGL pipeline (very important)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Esxi直通板载Sata
- 下一篇: 在图像中截取小图并保存