mirror of https://github.com/axmolengine/axmol.git
More client side buffer fixes.
This commit is contained in:
parent
77dda8c828
commit
b9d3bfd545
|
@ -539,6 +539,20 @@ void CCTiledGrid3D::blit(void)
|
||||||
// Attributes
|
// Attributes
|
||||||
//
|
//
|
||||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords );
|
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords );
|
||||||
|
#ifdef EMSCRIPTEN
|
||||||
|
int numQuads = m_sGridSize.width * m_sGridSize.height;
|
||||||
|
|
||||||
|
// position
|
||||||
|
setGLBufferData(m_pVertices, (numQuads*4*sizeof(ccVertex3F)), 0);
|
||||||
|
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
|
||||||
|
// texCoords
|
||||||
|
setGLBufferData(m_pTexCoordinates, (numQuads*4*sizeof(ccVertex2F)), 1);
|
||||||
|
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
|
||||||
|
setGLIndexData(m_pIndices, n * 12, 0);
|
||||||
|
glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, 0);
|
||||||
|
#else
|
||||||
// position
|
// position
|
||||||
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices);
|
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices);
|
||||||
|
|
||||||
|
@ -546,6 +560,8 @@ void CCTiledGrid3D::blit(void)
|
||||||
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoordinates);
|
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoordinates);
|
||||||
|
|
||||||
glDrawElements(GL_TRIANGLES, (GLsizei)n*6, GL_UNSIGNED_SHORT, m_pIndices);
|
glDrawElements(GL_TRIANGLES, (GLsizei)n*6, GL_UNSIGNED_SHORT, m_pIndices);
|
||||||
|
#endif // EMSCRIPTEN
|
||||||
|
|
||||||
|
|
||||||
CC_INCREMENT_GL_DRAWS(1);
|
CC_INCREMENT_GL_DRAWS(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue