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

How to set the default-Background-Color to White Color ? #66

Closed
finscn opened this issue Dec 3, 2012 · 2 comments
Closed

How to set the default-Background-Color to White Color ? #66

finscn opened this issue Dec 3, 2012 · 2 comments

Comments

@finscn
Copy link
Contributor

finscn commented Dec 3, 2012

now, the default-Background-Color is black.
How to let it be white ?

@finscn
Copy link
Contributor Author

finscn commented Dec 3, 2012

I'd know how to do it.

Generally, the background color of the web-page(in Browser) is white, I hope GLView's default background color can be set to white too.

@phoboslab
Copy link
Owner

Initially all pixels for the screen buffer are set to transparent black (0x00000000). We could clear to white, but this would break Apps that use getImageData(), because "empty" pixels are then no longer transparent but white.

We could also change the EAGLView's background color to white and make the EAGLLayer non-opaque

self.backgroundColor = [UIColor whiteColor];
eaglLayer.opaque = false;

However, a non-opaque EAGLLayer is supposed to have some performance penalty.

Setting the eaglLayer's backgroundColor to white has no effect whatsoever:

eaglLayer.backgroundColor = [UIColor whiteColor].CGColor;

So I'm not sure if you can have an opaque EAGLLayer with an non-black background color.

But I believe this is a non issue anyway. If you want your background to be white, just do a fillRect over the whole screen:

ctx.fillStyle = '#fff';
ctx.fillRect( 0, 0, canvas.width, canvas.height );

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

2 participants