cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.02k stars 7.05k forks source link

FlipY3D issue if setDesignResolution and RenderTexture is used #20767

Open stefan80 opened 1 year ago

stefan80 commented 1 year ago

Steps to Reproduce:

Hi there,

I am using a NodeGrid to flip the screen. The NodeGrid visit is called between RenderTexture-> bebginClear() and end():

mRTex->beginWithClear(0, 0, 0, 255); mNodeGrid->visit(renderer, transform, flags); mRTex->end(); This works fine unless in AppDelegate the designResolutionSize was set. If I set the designResolutionSize, the rendered NodeGrid is scaled up ( I guess to match the glView->getFrameSize()

glview = GLViewImpl::createWithRect("xyz", cocos2d::Rect(0, 0, 1920, 1080)); glview->setDesignResolutionSize(1280, 720, ResolutionPolicy::SHOW_ALL); In that case the nodegrid layer is scaled by factor 1.5 (1080/720) automatically as soon as the FlipY3D action is executed.

If designResolutionSize is equal to the windows size (1920,1080), everything is fine.

I have no clue how to solve that issue. Can also share the complete code if someone wants to have a look. @stevetranby Maybe you have a hint? You often solved such transformation issues in the past.

I have created a small test project to reproduce the issue.

NodeGrid_RenderTexture_DesignResolution_Issue.zip

Thank you!

stefan80 commented 1 year ago

Maybe @zilongshanren @super626 @slackmoehrle can help like it was the case for issue https://github.com/cocos2d/cocos2d-x/issues/14057

Thanks!