diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index f220a57cb2..573efdd4ff 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1693,10 +1693,14 @@ const Mat4& Node::getNodeToParentTransform() const // If skew is needed, apply skew and then anchor point if (needsSkewMatrix) { - Mat4 skewMatrix(1, (float)tanf(CC_DEGREES_TO_RADIANS(_skewY)), 0, 0, - (float)tanf(CC_DEGREES_TO_RADIANS(_skewX)), 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1); + float skewMatArray[16] = + { + 1, (float)tanf(CC_DEGREES_TO_RADIANS(_skewY)), 0, 0, + (float)tanf(CC_DEGREES_TO_RADIANS(_skewX)), 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + }; + Mat4 skewMatrix(skewMatArray); _transform = _transform * skewMatrix; diff --git a/cocos/renderer/CCPrimitive.cpp b/cocos/renderer/CCPrimitive.cpp index 357e61fa43..e7a896c1ad 100644 --- a/cocos/renderer/CCPrimitive.cpp +++ b/cocos/renderer/CCPrimitive.cpp @@ -86,7 +86,7 @@ bool Primitive::init(VertexData* verts, IndexBuffer* indices, int type) void Primitive::draw() { - if(_verts && _indices) + if(_verts) { _verts->use(); if(_indices!= nullptr) @@ -98,7 +98,7 @@ void Primitive::draw() } else { - glDrawArrays((GLenum)_type, _count, _start); + glDrawArrays((GLenum)_type, _start, _count); } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); diff --git a/cocos/renderer/CCTextureAtlas.cpp b/cocos/renderer/CCTextureAtlas.cpp index b60c47bc92..a1c721011f 100644 --- a/cocos/renderer/CCTextureAtlas.cpp +++ b/cocos/renderer/CCTextureAtlas.cpp @@ -625,9 +625,9 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start) // glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * (n-start), &quads_[start], GL_DYNAMIC_DRAW); // option 3: orphaning + glMapBuffer - glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * (numberOfQuads-start), nullptr, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _capacity, nullptr, GL_DYNAMIC_DRAW); void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); - memcpy(buf, _quads, sizeof(_quads[0])* (numberOfQuads-start)); + memcpy(buf, _quads, sizeof(_quads[0])* _totalQuads); glUnmapBuffer(GL_ARRAY_BUFFER); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -661,7 +661,7 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start) // XXX: update is done in draw... perhaps it should be done in a timer if (_dirty) { - glBufferSubData(GL_ARRAY_BUFFER, sizeof(_quads[0])*start, sizeof(_quads[0]) * numberOfQuads , &_quads[start] ); + glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(_quads[0]) * _totalQuads , &_quads[0] ); _dirty = false; }