The best material I have found and I have done several is Brownell's Acraglass "Gel". It is relatively stable and doesn't run, comes with a brown and black dye that can be used to color the glass material as you wish. Personally, I found the best way to be to obtain some plastic sheeting like page protectors and cut out pieces that can cover both the inside and outside and tape them in place using clear package sealing tape. Then mix the acraglass and put it into the cut out using popsicle sticks to tamp it down and fully fill the area.
After it sets up within a matter of 3 to 6 hours depending on temperature and humidity, you can remove the plastic sheeting but leave the glass alone. After 24 hours you can sand it or file it, cleaning it up and contouring it if necessary and make the top level. It will never crack and will be there forever. I have done it on both wood and GI synthetic stocks. I have not used it on non GI synthetics and would hesitate to do that until I test dome on a small spot. Resins don't adhere to all plastics. For glass bedding I would not hesitate to use the Acraglass Gel but have found that the material that the USMC armorers use is better. That's DEVCON Steel Epoxy which is superior to Acraglass but you can't dye it brown and I don't know about painting it either.
Bondo which is used extensively in auto body work could be used but it's prone to cracking. We've all probably seen cars that had paint that appears to be cracked or shattered on the outside. That is paint that was applied over bondo and it's the bondo cracking not the paint.