Update function for 3D graphics