build render function.