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

Font textures disappear, caused by glDeleteTextures on main thread #11

Open
tdanyluk opened this issue Dec 14, 2016 · 2 comments
Open

Comments

@tdanyluk
Copy link

Hello Saki!
Thanks for the excellent library!
However on the One Plus One phone i discovered that the font textures in the app disappear after pause/resume (changing app).
Like this

I think the problem is that glDeleteTextures is called in the main thread.
CameraSurfaceRenderer.onSurfaceDestroyed is called in the main thread.

Changing its code solves the problem:
This way it is good:

	public void onSurfaceDestroyed() {
		if (DEBUG) Log.v(TAG, "onSurfaceDestroyed:");

		GLSurfaceView parent = mWeakParent.get();
		parent.queueEvent(new Runnable() {
			@Override
			public void run() {
				if (mDrawer != null) {
					mDrawer.release();
					mDrawer = null;
				}

				if (mSTexture != null) {
					mSTexture.release();
					mSTexture = null;
				}

				GLDrawer2D.deleteTex(hTex);
			}
		});
	}

The error no longer happens however i am not sure that this is the best solution.
I would appriciate your kind help.

Best regards
Tamás

@elyonsaber
Copy link

I also met with this problem on some types of Xiaomi when hardware accelerated is set to true. Thanks to your solution, it seems to work well now!

@tdanyluk
Copy link
Author

I'm happy that I could help!

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