In general, the way to debug this is with glGetError(). Here's the method I use, which has helped me debug OpenGL. It checks if any errors have occurred, and throws an exception so you can debug. You can just copy-paste it somewhere and then call it in between draw calls to figure out what's causing problems.
Note: Instead of my hacky "DEBUGGING" flag below, you can also check whether Eclipse compiled the app in debug mode:
/** This method will check for any OpenGL errors that have occurred since the last time you called it.
* If it finds one, it will cause the program to crash immediately and output a stacktrace.
* To debug OpenGL, call this in between your OpenGL functions to zero in on where the error is.
* @param operationDescription Note to yourself about what you were doing, to be printed if there's an error
*/
static final void checkGlError(String operationDescription){
if(Main.DEBUGGING){//only do the program-crashing thing in debug mode. In release mode, try to ride through errors. Replace my boolean with yours.
int errorCode;
while ((errorCode = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
String error;
switch(errorCode) {
case GLES20.GL_INVALID_OPERATION: error="INVALID_OPERATION"; break;
case GLES20.GL_INVALID_ENUM: error="INVALID_ENUM"; break;
case GLES20.GL_INVALID_VALUE: error="INVALID_VALUE"; break;
case GLES20.GL_OUT_OF_MEMORY: error="OUT_OF_MEMORY"; break;
case GLES20.GL_INVALID_FRAMEBUFFER_OPERATION: error="INVALID_FRAMEBUFFER_OPERATION"; break;
default: error="Unknown error code";
}
Log.e("checkGlError", operationDescription + ": glError " + error);
throw new RuntimeException(operationDescription + ": glError " + error);
}
}
}