Clear framebuffer and stop rendering

Started by ap, May 06, 2015, 09:11:01 AM

Previous topic - Next topic

ap

Hello

I'm trying to switch visibility of the OpenGL context quite fast, so in order to turn the visibility off I'm trying to clear the framebuffer and then stop rendering (so the onDrawFrame wouldn't be called and the result will be a fixed black screen, until resumed).
If I'm switching the visibility of the view, it destroys the OpenGL context, and I would like it to preserve if because pausing and resuming can occur really fast.

I noticed there isn't really a way to clear all buffers (due to triple-buffering on my mobile GPU, I need to call clear() on my framebuffer 3 times from onDrawFrame() before  the view is actually cleared).
I could clear the framebuffer in onDrawFrame() and then return (so nothing is drawn), but then the OpenGL thread still remains active and it isn't really necessary.

Is there a good way for doing something like that - clearing framebuffer and stop rendering?

Thanks
AP


EgonOlsen

I'm not sure. I had a similar problem once and didn't come up with a proper solution. Then again, i haven't looked for one very long...

Maybe clearing the buffer multiple times before stopping the rendering will do the trick? Like 1st clear, buffer switch, 2nd clear, buffer switch, 3rd clear, buffer switch...stop?

ap

That's exactly what I did eventually... it worked. I was hoping for a more elegant solution :)