Epoxy will form a decent mechanical bond when applied directly to glass surfaces. For bonding applications where flexibility or expansion and contraction may be a factor, there are other materials that may be more suitable than epoxy.
It is extremely important to ensure that the glass surface has been cleaned and is free of any dirt, dust, grease, oil, water, waxes, or any other foreign materials, before applying epoxy.