i’m porting a game from MS DirectX.
using CCRenderTexture was good, but found a bug similar bug #608
I’m using “cocos2d-2.0-rc0a-x-2.0-358-g26b7ba2”, but similar problemd occured;
attched file is my problem occurred at test/tests/RenderTextureTest.cpp
(screenshot by GalaxyTab Android 3.1)
Reproduece steps:
excute tests/tests sample, and select RenderTextureTest
draw any text using your finger like “A” (Top menu string is “Touch the screen…”)
press Home key( or tap power key ), then wake-up.
drawn text is rotated 180 degrees!
again press Home key( or tap power key ), then wake-up.
I had the same problem with cocos2d-1.0.1-x-0.12.0 and fixed it by changing some code in CCRenderTexture.cpp:
In bool CCRenderTexture::getUIImageFromBuffer(CCImage *pImage, int x, int y, int nWidth, int nHeight), at line ~351, search for the following code:
// to get the actual texture data
// #640 the image read from rendertexture is upseted
for (int i = 0; i < nSavedBufferHeight; ++i)
{
memcpy(&pBuffer[i * nSavedBufferWidth * 4],
&pTempData[(y + nSavedBufferHeight - i - 1) * nReadBufferWidth * 4 + x * 4],
nSavedBufferWidth * 4);
}
and change it to:
// to get the actual texture data
// #640 the image read from rendertexture is upseted
for (int i = 0; i < nSavedBufferHeight; ++i)
{
memcpy(&pBuffer[i * nSavedBufferWidth * 4],
&pTempData[(y + i) * nReadBufferWidth * 4 + x * 4],
nSavedBufferWidth * 4);
}
Can somebody of the cocos2d-x team officially prove that this was a real bug and my suggestion would be a proper fix, please? Thanks!
Hi.
I have the same problem. I use cocos2d-2.0-rc2-x-2.0.1.
Thank you for sharing youre solution, but if press Home key second time and wakeup - texture is missing.
I hope cocos2d-x team will soon complete their holidays and at last fixed a all known bugs
Hi.
I have the same problem. I use cocos2d-2.0-rc2-x-2.0.1.
Thank you for sharing youre solution, but if press Home key second time and wakeup - texture is missing.
>
I hope cocos2d-x team will soon complete their holidays and at last fixed a all known bugs
it seems that cocos2d-x team have no plan to fix CCRenderTexture bugs.
finally, i abandoned it.
instead of using CCRenderTexture, i used plain CCSprite.
i made a new CCSprite every frame, but got 29 fps in android.
I think they did and still do a great job here - but I also think they do just too much at once.
XNA, HTML5 and two cocos2d-x branches with several supported platforms PLUS I really wish they can, but I doubt that everybody in the team is able to make a living of the cocos2d-x donations only - so they probably have to work on other (paid) projects, too.