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
Render upside down using WebGL on Safari #2283
Comments
weird! will make sure to take a look.. |
I seem to have a similar problem with canvas being flipped upside down on Safari whereas Chrome displays it correct. |
Now I set diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js
index 05258f6..82b1c84 100644
--- a/src/core/renderers/webgl/WebGLRenderer.js
+++ b/src/core/renderers/webgl/WebGLRenderer.js
@@ -396,6 +396,9 @@ WebGLRenderer.prototype.updateTexture = function (texture)
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);
+ if (texture.flipY) {
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1);
+ }
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultipliedAlpha);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source); |
I have a similar problem where I add Sprites to a Sprites and then on the canvas call toDataURL(). The image returned is flipped vertically on newer safari, while older safari (7.1 tested) and other browsers seems to return a non flipped image. Any suggestions how to fix this? @holymonson maybe worth testing on older safari to see if you have a similar behaviour? |
Curious if anyone have found the source to this problem? |
for the sake of not letting this thread die: I haven't found a solution to it and had to fall back to forced canvas rendering. |
This might be related to WebGL context |
I hate an idea of how could that happen, but i need to reproduce it first. |
Here is a reproducible case; only affects images generated with |
is there a way to export with toDataURL API the image not flipped? |
Its not guaranteed that toDataURL and getImageData returns right stuff for WebGL, its not even in the standard. You have to use PIXI extract API: //if you want canvas
var canvas =renderer.extract.canvas(stage);
//if you want base64
var base64=renderer.extract.base64(stage); |
var base64=renderer.extract.base64(stage); and var canvas =renderer.extract.canvas(stage); fix the upside down issue But then the size of the canvas has changed, and background colors do not persist. Any suggestions |
I am using PIXI.RenderTexture which fixes the image size issue, but the background color still does not stick |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi, here is the situation:
When test it on Safari (iOS / Mac OS X),
renderer_2.view
is fliped upside down againstfilmObj
, whilerenderer_1.view
is natural. It seems likerenderer_2
rendering incorrect coordinate onrenderer_1.view
. Would you please check if anything worng?Addtional Info:
CanvasRenderer
everything is fine too, even on Safari.The text was updated successfully, but these errors were encountered: