Cesium原理篇:6 Render模块(5: VAO&RenderState&Command)

VAO

       VAO(Vertext Array Object),中文是顶点数组对象。之前在《Buffer》一文中,我们介绍了Cesium如何创建VBO的过程,而VAO可以简单的认为是基于VBO的一个封装,为顶点属性数组和VBO中的顶点数据之间建立了关联。我们来看一下使用示例:

复制代码
var indexBuffer = Buffer.createIndexBuffer({
    context : context,
    typedArray : indices,
    usage : BufferUsage.STATIC_DRAW,
    indexDatatype : indexDatatype
}); var buffer = Buffer.createVertexBuffer({
    context : context,
    typedArray : typedArray,
    usage : BufferUsage.STATIC_DRAW
}); // 属性数组,当前是顶点数据z // 因此,该属性有3个分量XYZ // 值类型为float,4个字节 // 因此总共占3 *4= 12字节 attributes.push({
    index : 0,
    vertexBuffer : buffer,
    componentsPerAttribute : 3,
    componentDatatype : ComponentDatatype.FLOAT,
    offsetInBytes : 0,
    strideInBytes : 3 * 4
        		

延伸阅读

学习是年轻人改变自己的最好方式-Java培训,做最负责任的教育,学习改变命运,软件学习,再就业,大学生如何就业,帮大学生找到好工作,lphotoshop培训,电脑培训,电脑维修培训,移动软件开发培训,网站设计培训,网站建设培训学习是年轻人改变自己的最好方式