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

Background flickers first few moments of the app #46

Closed
marcakafoddex opened this issue Oct 18, 2022 · 1 comment
Closed

Background flickers first few moments of the app #46

marcakafoddex opened this issue Oct 18, 2022 · 1 comment

Comments

@marcakafoddex
Copy link
Contributor

When I start my glfm based app, the first few short moments there is a bright green flash behind the rendered scene.
See the video below:

video5942563557299194754.mp4

This happens every time I minimize the app, and go back in. Also when I start the app for the first time.

It seems to be the green default Android icon that is mixed in with my rendering.

Now I've double checked that:

  • i'm on the latest version of glfm
  • i'm clearing my buffers every time I render (both GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT)
  • i set the clear color & depth using glClearColor and glClearDepthf
  • my viewport, blending etc. settings are correct

Is there anything glfm related that could cause this? Is there some sort of blending setting I can change in Android or something? I realize this MIGHT not be glfm related, but as of now I just don't know for certain.

Thanks in advance for any help!
Marc

@marcakafoddex
Copy link
Contributor Author

Okay, I figured this out now, you gotta love rubber ducking...

I did everything right except for ONE thing: I cleared my color to alpha 0.f!

So I wrote:
glClearColor(0.0f, 0.0f, 0.0f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);

But I should have written:
glClearColor(0.0f, 0.0f, 0.0f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);

With the alpha values set to 0, apparently Android felt the need to blend my rendering in with its own activity background or something, for the first 500 milliseconds or so.

Clearing the alpha to 1.0 immediately fixed my problem!

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