PyOpenGL之glVertexAttribPointer

  1. PyOpenGL 开发参考文档:
    1. LearnOpenGL-cn
    2. 简书-Python之OpenGL笔记,大龙10
    3. PyOpenGL-API
  2. glVertexAttribPointer的API
Set an attribute pointer for a given shader (index)

    index -- the index of the generic vertex to bind, see
        glGetAttribLocation for retrieval of the value,
        note that index is a global variable, not per-shader
    size -- number of basic elements per record, 1,2,3, or 4
    type -- enum constant for data-type
    normalized -- whether to perform int to float
        normalization on integer-type values
    stride -- stride in machine units (bytes) between
        consecutive records, normally used to create
        "interleaved" arrays
    pointer -- data-pointer which provides the data-values,
        normally a vertex-buffer-object or offset into the
        same.

    This implementation stores a copy of the data-pointer
    in the contextdata structure in order to prevent null-
    reference errors in the renderer.
  1. 最后一个参数Pointer的坑
    在python中,不能直接设置为0,必须要转为c_types的的格式,否则是跑不通的!
    此处参考了资料中代码的写法。
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页