Hi,
i use the CCTransitionPageTurn to change my scenes and it works properly as long as the design resolutionsize is equal to the ressource size.
But now i wanted to implement support for other devices and therefore i calculate and set the contentscalefactor at applicationDidFinishLaunching by calling CCDirector::setContentScaleFactor.
The rest of my application works fine but the transition effect is broken (simulator and also on physical devices). The effect will only render in a quarter part of the screen (dependent on the scalefactor).
I’ve played around and it seems that the problem is already been in the base class CCGridBase. For example in the method CCGridBase::set2DProjection i found following:
@
CCSize size = director~~>getWinSizeInPixels;
…
glViewport), ) );
…
kmMat4OrthographicProjection, 0, size.height * CC_CONTENT_SCALE_FACTOR,~~1, 1);
@
But director->getWinSizeInPixels already returns the scaled rect and so the muliplication with CC_CONTENT_SCALE_FACTOR is not correct in my opinion. I’ve changed the lines and now the sprites on the effect page have the correct size but the transition effect is still rendered in a part of the screen.
Can anyone help me or can give mit some hints to solve the problem by my self?
Currently i try to trace the process and suspect the CCTexture2D where the effect is rendered. Maybe the size of this is wrong or the screen capture CCGrabber does not work proper.
i’ve found the solution, basically all effects which used CCGridBase should have the problem if you use it with Contentscale (CCDirector::setContentScaleFactor != 1.0).
cocos2d-x 2.0.4 and 2.1.0 are affected and the attached fix works for me, maybe anyone can verify it and add it to the main source tree.
Peter Lang wrote:
Hi,
i use the CCTransitionPageTurn to change my scenes and it works properly as long as the design resolutionsize is equal to the ressource size.
But now i wanted to implement support for other devices and therefore i calculate and set the contentscalefactor at applicationDidFinishLaunching by calling CCDirector::setContentScaleFactor.
The rest of my application works fine but the transition effect is broken (simulator and also on physical devices). The effect will only render in a quarter part of the screen (dependent on the scalefactor).
>
I’ve played around and it seems that the problem is already been in the base class CCGridBase. For example in the method CCGridBase::set2DProjection i found following:
@
CCSize size = director~~>getWinSizeInPixels;
…
glViewport), ) );
…
kmMat4OrthographicProjection, 0, size.height * CC_CONTENT_SCALE_FACTOR,~~1, 1);
@
>
But director->getWinSizeInPixels already returns the scaled rect and so the muliplication with CC_CONTENT_SCALE_FACTOR is not correct in my opinion. I’ve changed the lines and now the sprites on the effect page have the correct size but the transition effect is still rendered in a part of the screen.
Can anyone help me or can give mit some hints to solve the problem by my self?
Currently i try to trace the process and suspect the CCTexture2D where the effect is rendered. Maybe the size of this is wrong or the screen capture CCGrabber does not work proper.
>
best regards
unfortunately the grid size was also wrong, therefore now the extended patch…
Peter Lang wrote:
Hi,
i use the CCTransitionPageTurn to change my scenes and it works properly as long as the design resolutionsize is equal to the ressource size.
But now i wanted to implement support for other devices and therefore i calculate and set the contentscalefactor at applicationDidFinishLaunching by calling CCDirector::setContentScaleFactor.
The rest of my application works fine but the transition effect is broken (simulator and also on physical devices). The effect will only render in a quarter part of the screen (dependent on the scalefactor).
>
I’ve played around and it seems that the problem is already been in the base class CCGridBase. For example in the method CCGridBase::set2DProjection i found following:
@
CCSize size = director~~>getWinSizeInPixels;
…
glViewport), ) );
…
kmMat4OrthographicProjection, 0, size.height * CC_CONTENT_SCALE_FACTOR,~~1, 1);
@
>
But director->getWinSizeInPixels already returns the scaled rect and so the muliplication with CC_CONTENT_SCALE_FACTOR is not correct in my opinion. I’ve changed the lines and now the sprites on the effect page have the correct size but the transition effect is still rendered in a part of the screen.
Can anyone help me or can give mit some hints to solve the problem by my self?
Currently i try to trace the process and suspect the CCTexture2D where the effect is rendered. Maybe the size of this is wrong or the screen capture CCGrabber does not work proper.
>
best regards
Try the above fix.
It worked fine for me, and it really takes 5 minutes to do.
As I said, it wiould be great to push those changes to git, but I still don’t know how to do. Too busy, and haven’t go time to find out how it works, but I’m quite sure it must be easy.