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
Transparent WebM videos do not clear previous alpha (Fix included!) #4089
Comments
I do that kind of fixes in GLTexture for every of my projects. There'll be a way to make your custom uploader in v5. Right now the best strategy is DIY: PIXI.glCore.GLTexture.prototype.upload = function(source)
{
this.bind();
var gl = this.gl;
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);
var isVideo = !!source.videoWidth;
var newWidth = isVideo ? source.videoWidth : source.width;
var newHeight = isVideo ? source.videoHeight : source.height;
if(newHeight !== this.height || newWidth !== this.width || isVideo)
{
gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source);
}
else
{
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.format, this.type, source);
}
this.width = newWidth;
this.height = newHeight;
}; Put it in separate file in your project, name it "pixi-patch.js". I have tens of patches like that for different libs I use. |
I suggest we add special flag for V5 default uploader, "always use texImage2D" |
@kurozael ping |
Hi, yes this is fine, or can we just detect if it is a video like your example? |
BTW, this issue is also causing video textures to be extremely slow: |
@ivanpopelyshev Thank you so much for this. Was driving me crazy. Luckily patching |
@englercj Can I just get your confirmation that you changed to using texImage2D for v5 please? Various different PRs refer each other, and I think this is solved for v5, and a workaround has been given for v4, and thus this can be closed! Thanks |
this patch doesn't work anymore on chrome 70 … additionally pixi5/chrome70 on windows reintroduces the original issue |
Confirmed that the solution above stopped working since Chrome 70 update on Window machine only. OSX still works fine. @ivanpopelyshev could this be reopened or should I create a new issue ? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
In case it helps anyone still running into this problem, it most certainly is an issue with The link @saschagehlich posted was incredibly valuable to helping dig deeper into this. The answer/patch above no longer works for PIXI v5, instead we patched import { resources } from 'pixi.js'
resources.BaseImageResource.prototype.upload = function(renderer, baseTexture, glTexture, source) {
const gl = renderer.gl;
const width = baseTexture.realWidth;
const height = baseTexture.realHeight;
source = source || this.source;
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.premultiplyAlpha);
// add this line, check for video
const isVideo = !!source.videoWidth
if (!isVideo && baseTexture.target === gl.TEXTURE_2D && glTexture.width === width && glTexture.height === height)
{
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);
}
else
{
glTexture.width = width;
glTexture.height = height;
gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);
}
return true
} The results are really quite drastic. I know this issue is stale but I would like to throw my hat in the ring for an option to possibly bypass |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm just bumping this because it still needs addressing. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please see #3526
It's urgent for our project to have this fix implemented into the latest Pixi.js release, we don't want to have to modify ourselves.
Thanks.
The text was updated successfully, but these errors were encountered: