cc.RenderTexture + ccui.ScrollView = black screen

cc.RenderTexture + ccui.ScrollView = black screen
0.0 0


Is anybody aware of this issue?

Under some circumstances, while using UIScrollView, the whole screen or parts of it turns black!
This happens because cc.renderer._cacheToBufferCmds is not cleared completely during rendering and some render commands stays there forever. Manually calling to cc.renderer._removeCache() helps, but…


No, the problem seems to be somewhere inside _isCacheToBufferOn property of RendererWebGL.js

Somebody turns this flag to TRUE and everybody starts to push their commands to _cacheToBufferCmds. And then comes ScrollView.visit(), which internally caches all it’s child commands. So, at first it flushes that cache, so all previously stored commands are lost. And we’ve got partially black screen O_O


Okay. This happens because of using RenderTexture.

On beginWithClear() RT turns on isCacheToBufferOn, renders everything, clears it’s cache and forgets to turn that flag off. After that RT, all nodes start to render to cache, using ScrollView._instanceId as cache key (cc.renderer._currentID, which was set in the previous frame). So, when ScrollView.visit() is called, it clears that cache and everything, rendered “between” RT and ScrollView is lost. Including ScrollView’s renderCmd.


And isCacheToBufferOn flag is not turned off on RT.end() because of this code:
var locIDs = this._cacheInstanceIds; if (locIDs.length === 0) this._isCacheToBufferOn = false;

cacheInstanceIds is not empty because it contains cache from ScrollView…


I’ve come across the same issue using cc.RenderTexture + ccui.ScrollView, did you manage to find a work around ?