Merge pull request #13036 from fusijie/fix_12505

fix shader-basic testcase 'center' uniform error.
This commit is contained in:
pandamicro 2015-07-27 15:40:44 +08:00
commit 3cc039b063
1 changed files with 4 additions and 1 deletions

View File

@ -111,7 +111,10 @@ void ShaderNode::setPosition(const Vec2 &newPosition)
{
Node::setPosition(newPosition);
auto position = getPosition();
_center = Vec2(position.x * CC_CONTENT_SCALE_FACTOR(), position.y * CC_CONTENT_SCALE_FACTOR());
auto frameSize = Director::getInstance()->getOpenGLView()->getFrameSize();
auto visibleSize = Director::getInstance()->getVisibleSize();
auto retinaFactor = Director::getInstance()->getOpenGLView()->getRetinaFactor();
_center = Vec2(position.x * frameSize.width / visibleSize.width * retinaFactor, position.y * frameSize.height / visibleSize.height * retinaFactor);
getGLProgramState()->setUniformVec2("center", _center);
}