gltfutils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:python-gltf-experiments 作者: jzitelli 项目源码 文件源码
def draw_primitive(primitive, gltf,
                   modelview_matrix=None,
                   projection_matrix=None,
                   view_matrix=None,
                   normal_matrix=None):
    set_draw_state(primitive, gltf,
                   modelview_matrix=modelview_matrix,
                   projection_matrix=projection_matrix,
                   view_matrix=view_matrix,
                   normal_matrix=normal_matrix)
    index_accessor = gltf['accessors'][primitive['indices']]
    index_bufferView = gltf['bufferViews'][index_accessor['bufferView']]
    gl.glBindBuffer(index_bufferView['target'], index_bufferView['id'])
    gl.glDrawElements(primitive['mode'], index_accessor['count'], index_accessor['componentType'],
                      c_void_p(index_accessor['byteOffset']))
    global num_draw_calls
    num_draw_calls += 1
    if CHECK_GL_ERRORS:
        if gl.glGetError() != gl.GL_NO_ERROR:
            raise Exception('error drawing elements')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号