问题
I'm trying to utilize setDebugFlags as recommended here to scan for opengl errors:
http://developer.android.com/resources/articles/glsurfaceview.html
I put it in my surfaceview's constructor:
public MySurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
setEGLContextClientVersion(2);
setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS);
_renderer = new MyRenderer(getContext());
setRenderer(_renderer);
setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
Yet when running I don't see anything in verbose logcat, either under my session filter or all messages. No opengl calls, no opengl errors.
I'm manually checking for error at the end of each frame and I do have an error, but I don't know where it is coming from yet. Am I missing something obvious to get setDebugFlags to work?
回答1:
This is due to the way the wrapper works. See the EglHelper's createSurface method, which is the only place where mDebugFlags is used. It wraps the GL10 instance and returns it. However, since you're using ES 2.0, you must use static function calls to GLES20, that cannot be wrapped the way it is done.
Still better, even if you used only GLES by calling into GL10 instance methods, setting debug flags will prevent you from using the extension interfaces. GL11 seems to be totally unsupported in this regard. This bug is now over 2 years old, so better implement something yourself; JOGL seems to have a nice hierarchy, however, I didn't really look at it, so I cannot be sure.
来源:https://stackoverflow.com/questions/9658863/android-opengl-es-2-0-setdebugflags-doesnt-do-anything