I have an Android project with two activities. One is my main activity, using a GLSurfaceView
that gets updated from native code. The other is a PurchaseActivity
that opens up Google's In-App Billing client to make purchases. Making purchases works fine.
The problem I'm running into is that after the PurchaseActivity
finishes, whether it completes successfully, errs, or is cancelled, and it switches back to the main activity, the EGL context disappears and I receive:
call to OpenGL ES API with no current context (logged once per thread)
After that the onSurfaceCreated()
and onSurfaceChanged()
methods are retriggered.
I found this question similar but mine is already running in a separate activity and if I remove the finish()
call, it just remains stuck in the PurchaseActivity
.
Do I really need to reload the textures after making an in-app billing call? It seems this shouldn't be necessary at this point since the app is not being suspended.
My renderer code is pretty basic but for whatever reason, after the billing client window closes, it triggers a new surface and blows up my native code:
public class GameRenderer implements GLSurfaceView.Renderer
{
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{ }
public void onSurfaceChanged(GL10 gl, int width, int height)
{
BaseLib.setScreenSize(width, height);
BaseLib.init();
}
public void onDrawFrame(GL10 gl)
{
BaseLib.render();
}
}