Explanation of jit.gl.buffer @type


    Jan 23 2022 | 10:09 am
    Hi, I am trying to move some calculations from the cpu to the gpu by using jit.gl.tf with jit.gl.buffer instead of jit.gen with jit.matrix. I understand how the buffer types 'position' and 'color' bind to the jit.gl.mesh object, but I am unsure the others, especiall vertex_attr, so I don't know which type to use for which value and how to bind them correctly (and what to do with values that don't need to be bound to the mesh but still are need to be calculated every time). The reference does not explain the different types in detail, so I was wondering if there is an explenation somewhere that I overlooked.

    • Jan 23 2022 | 5:01 pm
      Hey Misemao,
      in the reference tab are reported the possible types you can select (except "color" that is missing for some reasons...). This is how you can bind each type of buffer:
      • color // <param name="color" type="vec4" state="COLOR" />
      • position // <param name="position" type="vec3" state="POSITION" />
      • texcoord // <param name="texcoord" type="vec2" state="TEXCOORD" />
      • normal // <param name="normal" type="vec3" state="NORMAL" />
      • tangent // <param name="tangent" type="vec3" state="TANGENT" />
      • bitangent // <param name="bitangent" type="vec3" state="BITANGENT" />
      • vertex_attr // <param name="vertex_attr" type="vec3" state="VERTEX_ATTR" />
      • vertex_attr0 // <param name="vertex_attr0" type="vec3" state="VERTEX_ATTR0" />
      • vertex_attr1 // <param name="vertex_attr1" type="vec3" state="VERTEX_ATTR1" />
      • vertex_attr2 // <param name="vertex_attr2" type="vec3" state="VERTEX_ATTR2" />
      • vertex_attr3 // <param name="vertex_attr3" type="vec3" state="VERTEX_ATTR3" />
      Use vertex_attr if you have only one vertex attribute to use, otherwise, use vertex_attr0, 1, 2[...]7.