From c73c84f79b4cca462b3b2c7263312c7f96cd15e3 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 28 Mar 2012 17:02:07 +0800 Subject: [PATCH] issue #1056: Fixed a bug in CCDirector::setProjection. We should invoking kmGLMultMatrix(&orthoMatrix) after invoking kmMat4OrthographicProjection. --- cocos2dx/CCDirector.cpp | 1 + cocos2dx/kazmath/src/mat4.c | 6 +++--- cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 5e1b874ac0..d5ea09de0e 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -339,6 +339,7 @@ void CCDirector::setProjection(ccDirectorProjection kProjection) kmGLLoadIdentity(); kmMat4 orthoMatrix; kmMat4OrthographicProjection(&orthoMatrix, 0, size.width, 0, size.height, -1024, 1024 ); + kmGLMultMatrix(&orthoMatrix); kmGLMatrixMode(KM_GL_MODELVIEW); kmGLLoadIdentity(); } diff --git a/cocos2dx/kazmath/src/mat4.c b/cocos2dx/kazmath/src/mat4.c index d84504d058..5b2f768eca 100644 --- a/cocos2dx/kazmath/src/mat4.c +++ b/cocos2dx/kazmath/src/mat4.c @@ -87,9 +87,9 @@ int gaussj(kmMat4 *a, kmMat4 *b) { int i, icol = 0, irow = 0, j, k, l, ll, n = 4, m = 4; float big, dum, pivinv; - int indxc[4]; - int indxr[4]; - int ipiv[4]; + int indxc[4] = {0}; + int indxr[4] = {0}; + int ipiv[4] = {0}; for (j = 0; j < n; j++) { ipiv[j] = 0; diff --git a/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp index 745231772d..16ef050e54 100644 --- a/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp @@ -180,7 +180,7 @@ void CCTMXLayer::setupTiles() // XXX: gid == 0 --> empty tile if( gid != 0 ) { - this->appendTileForGID(gid, ccp((float)x, (float)y)); + this->appendTileForGID(gid, ccp(x, y)); // Optimization: update min and max GID rendered by the layer m_uMinGID = MIN(gid, m_uMinGID);