issue #2410: [Reverting] Don't use 'ccGLEnableVertexAttribs' when using VAO, use 'glEnableVertexAttribArray' instead.

This commit is contained in:
James Chen 2013-07-17 13:55:31 +08:00
parent 209392085c
commit cd136e6330
1 changed files with 4 additions and 3 deletions

View File

@ -163,17 +163,18 @@ bool DrawNode::init()
glGenVertexArrays(1, &_vao);
ccGLBindVAO(_vao);
#endif
glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)* _bufferCapacity, _buffer, GL_STREAM_DRAW);
ccGLEnableVertexAttribs( kVertexAttribFlag_PosColorTex );
glEnableVertexAttribArray(kVertexAttrib_Position);
glVertexAttribPointer(kVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
glEnableVertexAttribArray(kVertexAttrib_Color);
glVertexAttribPointer(kVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
glEnableVertexAttribArray(kVertexAttrib_TexCoords);
glVertexAttribPointer(kVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
glBindBuffer(GL_ARRAY_BUFFER, 0);