{"record":{"id":"87fa237c501e289b","repo":"wasabeef/android-gpuimage","slug":"rendermode","errorCode":null,"errorMessage":"renderMode","messagePattern":"renderMode","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java","lineNumber":1465,"sourceCode":"                synchronized (glThreadManager) {\n                    stopEglSurfaceLocked();\n                    stopEglContextLocked();\n                }\n            }\n        }\n\n        public boolean ableToDraw() {\n            return haveEglContext && haveEglSurface && readyToDraw();\n        }\n\n        private boolean readyToDraw() {\n            return (!paused) && hasSurface && (!surfaceIsBad) && (width > 0) && (height > 0) && (\n                    requestRender || (renderMode == RENDERMODE_CONTINUOUSLY));\n        }\n\n        public void setRenderMode(int renderMode) {\n            if (!((RENDERMODE_WHEN_DIRTY <= renderMode) && (renderMode <= RENDERMODE_CONTINUOUSLY))) {\n                throw new IllegalArgumentException(\"renderMode\");\n            }\n            synchronized (glThreadManager) {\n                this.renderMode = renderMode;\n                glThreadManager.notifyAll();\n            }\n        }\n\n        public int getRenderMode() {\n            synchronized (glThreadManager) {\n                return renderMode;\n            }\n        }\n\n        public void requestRender() {\n            synchronized (glThreadManager) {\n                requestRender = true;\n                glThreadManager.notifyAll();\n            }","sourceCodeStart":1447,"sourceCodeEnd":1483,"githubUrl":"https://github.com/wasabeef/android-gpuimage/blob/ceea576ec931c2968431ad46f1fb2e6d68a542e2/library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java#L1447-L1483","documentation":"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().","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n glTextureView.setRenderMode(2);\n// after\n glTextureView.setRenderMode(GLTextureView.RENDERMODE_CONTINUOUSLY);","handlingStrategy":"validation","validationCode":"if (mode != GLTextureView.RENDERMODE_WHEN_DIRTY && mode != GLTextureView.RENDERMODE_CONTINUOUSLY) {\n    throw new IllegalArgumentException(\"renderMode must be RENDERMODE_WHEN_DIRTY or RENDERMODE_CONTINUOUSLY: \" + mode);\n}\nglTextureView.setRenderMode(mode);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the RENDERMODE_* constants, never integer literals","Keep render mode selection in one central helper"],"tags":["android","gpuimage","opengl","illegal-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"ceea576ec931c2968431ad46f1fb2e6d68a542e2","analyzedAt":"2026-09-11T16:56:13.742Z","contentChangedAt":"2026-09-11T16:56:13.742Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}