目前我的函数用于转换eglGetError()
的结果如下:
std::string eglErrorString(EGLint error)
{
switch(error)
{
case EGL_SUCCESS: return "No error";
case EGL_NOT_INITIALIZED: return "EGL not initialized or failed to initialize";
case EGL_BAD_ACCESS: return "Resource inaccessible";
case EGL_BAD_ALLOC: return "Cannot allocate resources";
case EGL_BAD_ATTRIBUTE: return "Unrecognized attribute or attribute value";
case EGL_BAD_CONTEXT: return "Invalid EGL context";
case EGL_BAD_CONFIG: return "Invalid EGL frame buffer configuration";
case EGL_BAD_CURRENT_SURFACE: return "Current surface is no longer valid";
case EGL_BAD_DISPLAY: return "Invalid EGL display";
case EGL_BAD_SURFACE: return "Invalid surface";
case EGL_BAD_MATCH: return "Inconsistent arguments";
case EGL_BAD_PARAMETER: return "Invalid argument";
case EGL_BAD_NATIVE_PIXMAP: return "Invalid native pixmap";
case EGL_BAD_NATIVE_WINDOW: return "Invalid native window";
case EGL_CONTEXT_LOST: return "Context lost";
}
return "Unknown error "+to_hex_string(int(error));
}
例如,对于OpenGL本身,有gluErrorString()
函数,它可以帮助我们避免手动维护错误列表。
那么,EGL中是否有类似于gluErrorString()
的函数呢?
gluErrorString
函数。我的评论是说你不应该费心,而是自己维护。虽然这解决了你的问题,但并没有真正回答你所问的问题。我不知道是否存在某些标准的egluErrorString
函数,如果有的话,那就是对你问题的回答。 - Nicol Bolas