代码之家  ›  专栏  ›  技术社区  ›  Michael Dorgan

GLSL 2.0属性问题

  •  3
  • Michael Dorgan  · 技术社区  · 14 年前

    []运算符在寻址属性vec4时做什么?

    
    attribute vec4 a_MatrixWeights;
    ...
    foo(float weight);
    ...
    
    void main()
    {
      foo(a_MatrixWeights[0]);
      foo(a_MatrixWeights[1]);
      foo(a_MatrixWeights[2]);
      foo(a_MatrixWeights[3]);
    }
    

    这是处理vec4(.x,.y,.z,.w)的各个字段,还是处理vec4和vec4数组并执行其他操作?

    2 回复  |  直到 14 年前
        1
  •  4
  •   elmattic    14 年前

    mat4 m;
    vec4 c = m[1]; // access the second column of m
    
        2
  •  1
  •   Dr. Snoopy    14 年前