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

webgl background transparency #133

Open
Daemon456 opened this issue Aug 27, 2015 · 7 comments
Open

webgl background transparency #133

Daemon456 opened this issue Aug 27, 2015 · 7 comments

Comments

@Daemon456
Copy link

Canvas output has a transparent background, webgl output has a black background. Ideally webgl output background would be transparent.

@splhack
Copy link
Contributor

splhack commented Aug 28, 2015

Have you tried to set setBackgroundColor parameter? The default value is 0x000000ff (= R:0,G:0,B:0,A:255). setBackgroundColor: 0 may work.

@Daemon456
Copy link
Author

Thanks for the suggestion. I tried 0, and it is still black. I also tried the default: 0x000000FF, but that actually changed the background to blue.

@splhack
Copy link
Contributor

splhack commented Aug 28, 2015

hmm, so I recommend you to use developer console for checking WebGLRendererFactory.prototype.setBackgroundColor function doing right thing or not.

@Daemon456
Copy link
Author

in WebGLRendererFactory.prototype.setBackgroundColor I set the background color array to this: this.backGroundColor = [0, 0, 0, 0];

and in WebGLRendererFactory.prototype.setClearColor I set clearColor to this:
gl.clearColor(0, 0, 0, 0);

The background is still black.

@splhack
Copy link
Contributor

splhack commented Aug 28, 2015

How about changing alpha:false to alpha:true in this line?

alpha: false,

alpha: true,

@Daemon456
Copy link
Author

Doesn't change anything.

@KojiNakamaru
Copy link
Member

I guess you are testing your content on LWFS. Currently various WebGL implementations seem to have some issues for transparent canvases:

http://stackoverflow.com/questions/11554654/webgl-blendfunc-bug-or-misunderstanding
http://www.html5gamedevs.com/topic/9098-strange-webgl-results-on-ios8/

so that LWFS set the canvas's background to be black and opaque:

https://github.com/gree/lwfs/blob/6ad09ca406ff841190153d529190f6d7fe78cc2a/tmpl/js/test-html5.js#L533-L534

You should be able to get a transparent canvas by adjusting these code (and with alpha: true), but it may cause troubles in blending.

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

3 participants