gl: add a function to check and update textures