cocos2d/cocos2d-html5

RenderTexture black screen on web

yuriilychak opened this issue · 0 comments

Hello.
I try to add transparency mask to my game and have black screen every time when try to change mask position.
I create a sprite and set blend modes, and create render texture:

this._fadeTexture = new cc.RenderTexture(winSize.width, winSize.height, cc.Texture2D.PIXEL_FORMAT_RGBA8888);
this._fadeSprite = this._fadeTexture.getSprite();

this._spriteMask = new cc.Sprite("#UIElements/Other/CircleMask.png");
this._spriteMask.setBlendFunc(cc.ZERO, cc.ONE_MINUS_SRC_ALPHA);
this._spriteMask.retain();

When I select some object I use method to draw transparency mask in some position with some scale:

setMaskTransformation: function (position, scale) {
        this._spriteMask.setPosition(position);
        this._spriteMask.setScale(scale);
        this._fadeTexture.beginWithClear(this._fadeColor.r, this._fadeColor.g, this._fadeColor.b, this._fadeColor.a);
        this._spriteMask.visit();
        this._fadeTexture.end();
    },

And every time when I use this method on web I have black screen in few seconds.
I try:

  1. Change size of texture and scale it.
  2. Clear only rectangle where last frame image drawn.
  3. Draw negative of image alpha.
    Nothing help me, but when I reduced the texture size 16 times som part of my game are drawing.
    I try to use autoDraw, but it made it worse, the black screen became permanent.
    How to fix this?