Andreas Linden
Andreas Linden

Reputation: 12721

Android openGL - Surface is not valid Surface

Sometimes when i quit my openGL ES 1 application the following error messages keep beeing posted in logcat and the application freezes and at some point it's terminated.

E/EglHelper(4284): Surface is not valid Surface(name=null, identity=-1, mNativeSurface=0) java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface
E/GLThread(4284): Couldn't create a surface 132184
W/GLThread(4284): egl createSurface
W/EglHelper(4284): createSurface()  tid=22

where could be my problem?

Upvotes: 1

Views: 5139

Answers (1)

David C. Sainte-Claire
David C. Sainte-Claire

Reputation: 2481

One thing that you should check to see, if you haven't already solved this issue, is compare what you're doing in your Activity onPause / onDestroy callbacks to what you're doing in the surfaceDestroyed callback. If you're using a GLSurfaceView or else a standard SurfaceView to manually control OpenGL, you're only guaranteed to have a valid surface starting when the surfaceCreated callback has been called, and ending when surfaceDestroyed gets called. Therefore, if this is happening when your app exits, you should see if you're trying to manipulate the surface after it's already been destroyed.

One other thing to consider is that your logcat entries look like the exception was thrown when trying to call eglCreateWindowSurface() so you might want to look into why you're trying to create a new OpenGL drawing surface when your app exits.

Upvotes: 1

Related Questions