Projects > cpp > Issues > Bug #4703

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

RenderTexture issue 937 test doesn't work correct

Bug #4703 [Closed]
Fil1577 2014-04-07 14:57 . Updated almost 11 years ago

If you will try to render some node into RenderTexture and then add it to the scene, it will be rendered to RenderTexture only.

Example in RenderTextureIssue937. Only left half of image is visible.

Tested on Samsung galaxy s3, gt-i9300, and PC.
Possible reason is that same command goes to render queue twice.

zhangxm 2014-04-08 08:48
  • Assignee set to zhangbin@cocos2d-x.org
  • Priority changed from Low to High
Fil1577 2014-04-08 09:10

Bug localized:
_orderOfArrival variable drops to zero after single rendering.
It causes wrong rendering order in second rendering in the same quant.

zhangbin@cocos2d-x.org 2014-04-08 10:23
  • Project changed from cocos2d-x to cpp
zhangbin@cocos2d-x.org 2014-04-08 10:24
  • Target version set to 3.0-rc2
Romain 2014-04-08 23:22

What about issue 4532 with RenderTexture?
I provided a fix in the bug report, and here:
http://www.cocos2d-x.org/forums/6/topics/45860?r=49478#message-49478

Basicaly,
_fullRect and _fullviewPort definition have been switched in RenderTexture.cpp (check the .h description).
The effect is that the content of a RenderTexture is scaled (according to its size against the screen size), which is unexpected and different to previous versions of cocos2d-x.
The content scale should not vary based on RenderTexture size, and be identical to the content scale when drawing on screen (1 by default).

Sorry to insist on this.
And correct me if I'm wrong.

zhangbin@cocos2d-x.org 2014-04-09 07:38
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:3a9cfefc02dbefa536f2228b94018441e6a6097b.

Fil1577 2014-04-10 08:05

Looks like the problem was described incorrect in header post.

If you will change call order in test 937 like that:
addChild(spr_nonpremulti);
addChild(spr_premulti);
addChild(rend);

rend->begin();
spr_premulti->visit();
spr_nonpremulti->visit();
rend->end();

left half of the image will be rendered behind the background, but it must be rendered in order of arrival of children (in front of the background).

It might became a problem when you need to do rendering to the render texture and scene at each quant (for example for rendering shadows). After rendering into the render texture operation, witch has high priority, order of arrival changes and rendering to the scene corrupts. So we need to change order of arrival manually, or rebild the scene (remove/add children) in each quant.

Atom PDF

Status:Closed
Start date:2014-04-07
Priority:High
Due date:
Assignee:zhangbin@cocos2d-x.org
% Done:

100%

Category:all
Target version:3.0-rc2