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的的格式,否則是跑不通的!
    此處參考了資料中代碼的寫法。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章