zoukankan      html  css  js  c++  java
  • 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代替编译器的相应部分。

  • 相关阅读:
    hdu 1715
    hdu 1370
    hdu 2370
    hdu 1393
    hdu 1564
    hdu 1720
    hdu 1342
    SQL技巧(sp_procedure_params_rowset,SQL中设置数据值为null)
    Control ‘dg’ of type 'GridView' must be placed inside a form tag with runat=server
    GridView事件中获取rowIndex值
  • 原文地址:https://www.cnblogs.com/qingsunny/p/3304655.html
Copyright © 2011-2022 走看看