Imagination PowerVR SDK Blog

EGL_BAD_ALLOC Error


#1

i want to Draw 2D in my windows , so i  use the function Delete gles surfase(eglDestroySurface) , but when return 3D Draw,  i use the functon recreate the surface is failed(eglCreateWindowSurface), the error code is EGL_BAD_ALLOC. what can i do now?

thanks!

#2

 void DeleteSurface(void)
 {
  if(m_eglSurface != EGL_NO_SURFACE)
  {
   glFlush();
   eglMakeCurrent(m_eglDisplay ,EGL_NO_SURFACE ,EGL_NO_SURFACE , EGL_NO_CONTEXT);
   eglDestroySurface(m_eglDisplay,m_eglSurface);
   m_eglSurface = EGL_NO_SURFACE;
  }
 }


 void ResetSurface(void)
 {
  if(m_eglSurface == EGL_NO_SURFACE)
  {
   m_eglSurface = eglCreateWindowSurface(m_eglDisplay,m_eglConfig , m_nativeWindowType , NULL);
   eglMakeCurrent(m_eglDisplay ,m_eglSurface ,m_eglSurface , m_eglContext);
  }
 }