Restart GlSurfaceView On Button Click

I am currently working on an Android app and I am hoping to restart glSurfaceView on button click. Namely, when the button is pressed, the images must be read again in the program and all textures must be reset. What should I do? Thank.

+3


source to share


1 answer


It looks like you just want to reload the data and not recreate the textures after the user navigates back to your application. In this case, create a method in your renderer that is public, such as setResetFlag (). In this method, you are setting the boolean variable reset. In the onDrawFrame method, check if the flag is set and reload your textures / reset your state if it is set (resetting its state back to its nominal reset state). This way you offload the work to the openGL thread and keep the UI nice and responsive.



0


source







All Articles