GL debug improvements #626
This commit is contained in:
parent
cae68ffec9
commit
8c2f788069
@ -177,6 +177,25 @@ public class GLUtils {
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check GL out of memory.
|
||||
* See: https://www.khronos.org/opengl/wiki/OpenGL_Error
|
||||
*
|
||||
* @param op the operation which should be debugged
|
||||
* @return true if out of memory
|
||||
*/
|
||||
public static boolean checkGlOutOfMemory(String op) {
|
||||
int error; // GL.NO_ERROR
|
||||
boolean oom = false;
|
||||
while ((error = gl.getError()) != GL.NO_ERROR) {
|
||||
log.error(op + ": \tglError " + getGlErrorString(error) + " (" + error + ")");
|
||||
// throw new RuntimeException(op + ": glError " + error);
|
||||
if (error == GL.OUT_OF_MEMORY)
|
||||
oom = true;
|
||||
}
|
||||
return oom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param error the error code of OpenGL
|
||||
* @return the error code as string
|
||||
|
@ -160,7 +160,7 @@ public class MapRenderer {
|
||||
GLUtils.checkGlError(renderer.getClass().getName());
|
||||
}
|
||||
|
||||
if (GLUtils.checkGlErrors(getClass().getName() + ": finish").contains(GL.OUT_OF_MEMORY)) {
|
||||
if (GLUtils.checkGlOutOfMemory(getClass().getName() + ": finish")) {
|
||||
BufferObject.checkBufferUsage(true);
|
||||
// FIXME also throw out some textures etc
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user