diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 9d1e02f187..ac7519a062 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -1,4 +1,4 @@ -/**************************************************************************** +/**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2010-2013 cocos2d-x.org Copyright (c) 2011 Zynga Inc. @@ -763,6 +763,18 @@ Vec2 Director::convertToUI(const Vec2& glPoint) Vec4 glCoord(glPoint.x, glPoint.y, 0.0, 1); transform.transformVector(glCoord, &clipCoord); + /* + BUG-FIX #5506 + + a = (Vx, Vy, Vz, 1) + b = (a×M)T + Out = 1 ⁄ bw(bx, by, bz) + */ + + clipCoord.x = clipCoord.x / clipCoord.w; + clipCoord.y = clipCoord.y / clipCoord.w; + clipCoord.z = clipCoord.z / clipCoord.w; + Size glSize = _openGLView->getDesignResolutionSize(); float factor = 1.0/glCoord.w; return Vec2(glSize.width*(clipCoord.x*0.5 + 0.5) * factor, glSize.height*(-clipCoord.y*0.5 + 0.5) * factor);