Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RenderTexture black screen on web #3510

Open
yuriilychak opened this issue Aug 10, 2017 · 0 comments
Open

RenderTexture black screen on web #3510

yuriilychak opened this issue Aug 10, 2017 · 0 comments

Comments

@yuriilychak
Copy link

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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant