@Override public void freeFilterResources(GL2 gl) { if (linkedProgram != 0) { ShaderUtil.deleteShaderProgram(gl, linkedProgram); linkedProgram = 0; } if (linkedShader != 0) { ShaderUtil.deleteShader(gl, linkedShader); linkedShader = 0; } }
@Override public void allocateFilterResources(GL2 gl) { OptionalInt shader = ShaderUtil.createFragmentShader(gl, createSource()); if (shader.isPresent()) { linkedShader = shader.getAsInt(); OptionalInt program = ShaderUtil.createSingleShaderProgram(gl, linkedShader); if (program.isPresent()) { linkedProgram = program.getAsInt(); } else { ShaderUtil.deleteShaderProgram(gl, linkedProgram); linkedProgram = 0; } } }