• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

关于glVertexAttribPointer的用法

opengl-es-2.0 来源:Tarum 5次浏览
GLfloat m_tex[3][4][2] = { 
{ {{1.0, 2.0}, {2.0, 3.0}}, {{0.0, -3.0}, {9.0, 11.0}}, {{23.0, 12.0}, {43.0, 22.0}}, {{15.0, 4.0}, {3.0, 12.0}} }, 
{ {{13.0, 4.0}, {56.0, 3.0}}, {{5.0, 9.0}, {3.0, 5.0}}, {{3.0, 1.0}, {4.0, 9.0}}, {{5.0, 4.0}, {7.0, 12.0}} }, 
{ {{3.0, 9.0}, {6.0, 13.0}}, {{8.0, 19.0}, {13.0, 6.0}}, {{3.0, 3.0}, {9.0, 6.0}}, {{35.0, 7.0}, {13.0, 12.0}} } 
}; 

glVertexAttribPointer(Yloc, 2, GL_FLOAT, 0, 0, m_tex[0]); 
glVertexAttribPointer(Uloc, 2, GL_FLOAT, 0, 0, m_tex[1]); 
glVertexAttribPointer(Vloc, 2, GL_FLOAT, 0, 0, m_tex[2]); 

我知道glVertexAttribPointer的意思。它集m_tex[0] 2的值浮到顶点Ylocm_tex[0]包括:关于glVertexAttribPointer的用法

{{1.0, 2.0}, {2.0, 3.0}}, {{0.0, -3.0}, {9.0, 11.0}}, {{23.0, 12.0}, {43.0, 22.0}}, {{15.0, 4.0}, {3.0, 12.0}}

所以没有考虑前两个人? {1.0,2.0}

我不确定。

===========解决方案如下:

,这将需要在每次迭代

+-----------------------------------------------------------+ 
    | glVertexAttribPointer(Yloc, 2, GL_FLOAT, 0, 0, m_tex[0]); | 
    +-----------------------------------------------------------+ 
           |      | 
    take 2 floats each time  <+ from this set <-+ 
    [1.0,2.0] 

两个数如果更改2参数3它将迭代为成分〔X,Y,Z]

+-----------------------------------------------------------+ 
    | glVertexAttribPointer(Yloc, 3, GL_FLOAT, 0, 0, m_tex[0]); | 
    +-----------------------------------------------------------+ 
           |      | 
    take 3 floats each time  <+ from this set <-+ 
    [1.0,2.0,2.0] 

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)