wasabeef/android-gpuimage · error · IllegalArgumentException
renderMode
Error message
renderMode
What it means
GLTextureView.setRenderMode() validates that the renderMode argument is either RENDERMODE_WHEN_DIRTY (0) or RENDERMODE_CONTINUOUSLY (1). Any other integer throws IllegalArgumentException("renderMode"). This guards the flag stored on the GLThread that decides whether frames are drawn continuously or only on requestRender().
Solutions
- Pass GLTextureView.RENDERMODE_CONTINUOUSLY or GLTextureView.RENDERMODE_WHEN_DIRTY instead of a literal integer.
- Clamp/validate the value before calling: if (mode < RENDERMODE_WHEN_DIRTY || mode > RENDERMODE_CONTINUOUSLY) throw/correct.
- Search your code for setRenderMode( calls with non-constant arguments and replace with named constants.
Example fix
// before glTextureView.setRenderMode(2); // after glTextureView.setRenderMode(GLTextureView.RENDERMODE_CONTINUOUSLY);
Defensive patterns
Strategy: validation
Validate before calling
if (mode != GLTextureView.RENDERMODE_WHEN_DIRTY && mode != GLTextureView.RENDERMODE_CONTINUOUSLY) {
throw new IllegalArgumentException("renderMode must be RENDERMODE_WHEN_DIRTY or RENDERMODE_CONTINUOUSLY: " + mode);
}
glTextureView.setRenderMode(mode); Prevention
- Always use the RENDERMODE_* constants, never integer literals
- Keep render mode selection in one central helper
When it happens
Trigger: Calling GLTextureView.setRenderMode(int) with any value other than RENDERMODE_WHEN_DIRTY or RENDERMODE_CONTINUOUSLY — e.g. setRenderMode(2), a stale constant, or an offset/arithmetic mistake computing the mode.
Common situations: Copy-pasting render mode constants from GLSurfaceView subclasses that define custom values; passing a boolean coerced to int; typos where a drawing flag is passed instead of the render mode; SDK migration where constants were renumbered.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- eglChooseConfig failed
- r must not be null
- setRenderer has already been called for this instance.
- OpenGL ES 2.0 is not supported on this phone.
- No configs match configSpec
AI-assisted analysis of wasabeef/android-gpuimage@ceea576ec9 (2026-09-11).
Data as JSON: /api/errors/87fa237c501e289b.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java:1465
synchronized (glThreadManager) {
stopEglSurfaceLocked();
stopEglContextLocked();
}
}
}
public boolean ableToDraw() {
return haveEglContext && haveEglSurface && readyToDraw();
}
private boolean readyToDraw() {
return (!paused) && hasSurface && (!surfaceIsBad) && (width > 0) && (height > 0) && (
requestRender || (renderMode == RENDERMODE_CONTINUOUSLY));
}
public void setRenderMode(int renderMode) {
if (!((RENDERMODE_WHEN_DIRTY <= renderMode) && (renderMode <= RENDERMODE_CONTINUOUSLY))) {
throw new IllegalArgumentException("renderMode");
}
synchronized (glThreadManager) {
this.renderMode = renderMode;
glThreadManager.notifyAll();
}
}
public int getRenderMode() {
synchronized (glThreadManager) {
return renderMode;
}
}
public void requestRender() {
synchronized (glThreadManager) {
requestRender = true;
glThreadManager.notifyAll();
}View on GitHub (pinned to ceea576ec9)