The competition between shear deformation and crazing in glassy polymers