This is the general way to  make a 3D viewer on Khan Academy (Processing JavaScript)