我找到了以下代码:
glGenBuffers(1, &m_posVBO);
glBindBuffer(GL_ARRAY_BUFFER, m_posVBO);
glBufferData(GL_ARRAY_BUFFER, size, 0, GL_DYNAMIC_DRAW);
glVertexAttribPointer(particle_attributes::POSITION, 4, GL_FLOAT, GL_FALSE,0,0);
glEnableVertexAttribArray(particle_attributes::POSITION);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glGenBuffers(1, &m_colorVBO);
glBindBuffer(GL_ARRAY_BUFFER, m_colorVBO);
glBufferData(GL_ARRAY_BUFFER, size, 0, GL_DYNAMIC_DRAW);
glVertexAttribPointer(particle_attributes::COLOR, 4, GL_FLOAT, GL_FALSE,0,0);
glEnableVertexAttribArray(particle_attributes::COLOR);
glBindBufferARB(GL_ARRAY_BUFFER, m_posVBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, m_vPos, GL_DYNAMIC_DRAW_ARB);
glBindBufferARB(GL_ARRAY_BUFFER, m_colorVBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, m_vCol, GL_DYNAMIC_DRAW_ARB);
glBindBuffer(GL_ARRAY_BUFFER, 0);
我想知道为什么glBufferData()
和glBufferDataARB()
分别用一个唯一的VBO调用,而零值在glBindBuffer(GL_ARRAY_BUFFER, 0)
中代表什么?