Problem with CCTransitionPageTurn and CCDirector::setContentScaleFactor

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

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

I get the same problem in cocos2d-x 2.1.1
It happends if CCDirector’s ContentScaleFactor < 1.0.

With the changes that Peter Lang suggets, it works fine.

Should it be reported as a bug?

This problem still exists in latest version 2.1.2.
CCGrid.cpp needs to be fixed.

How can we request a fix?
I know there’s something called “pull request”, but I’ve never done anything like that, so I don’t know how it works.

Problem still exists in 2.1.3

was using CCWaves, ipad & ipad retina fine, but iphone5 was severely clipped. Design res was set to ipad.

Here too. The page curl works great when content scale factor is 1 or 2, but when set to 4 it gets funky (see attached video)

Some stats that might be helpful:

ContentScaleFactor = 4.000000
Cocos2d: TW designSize = 480.000000 x 360.000000
Cocos2d: TW screenSize = 2048.000000 x 1536.000000

cocos2d-2.1rc0-x-2.1.3

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.

Where is “fix attachment”? I can’t find any attach in this post. Please help