In many games I have seen that a plane can have bulletproof glass. I thought that this was not real in the war and that it was just a modern invention. But I read that the A6M0 "didn't have bulletproof glass", so it did exist.
Laminated and multi layer glass (you could call it bullet resistant or semi-armoured) was probably first used on a fighter aircraft around 2 years before the end of WW1. There were a number of aircraft - both German and British - that featured thick (~1.5 to 2 inch) forward windshields in service in 1916.
This wasn't proper 'bulletproof' glass - ie tempered and toughened. It was more akin to present day safety glass. However, there are accounts of it deflecting or stopping fire from opposing aircraft (and also failing to). 'TriPlex' was specifically marketed during WW1 as being 'bullet proof' and 'shatter proof' for use in aircraft windshields, instrument panels, observation windows and pilot goggles.
After seeing the size of the bullet casings and the holes in the fuselages I wonder if that glass was strong enough to withstand bullets. Was this glass effective?
Depends on what is doing the hitting, and the range and angle.
A plain old .303, .30-06, 7.62x54R or 7.92x57 ball round only has 2500 to 3000 ft pounds of energy. Striking from the rear at medium to long range (say, more than 250 yards), or at an oblique angle, these sorts of rounds might not penetrate. However, the same round hitting straight on, or from a head on attack might have enough energy to penetrate.
Something like a US .50 BMG or Soviet 12.7X108 round has a LOT more energy (about 18,000 to 20,000 ft pounds). That bigger, heavier round is probably going to punch through something that the smaller .30 cal class weapons cannot.
Bigger cannon (20mm and above) and above are a bit more of a mixed bag. They've got more energy again, and some of their ammunition was armour piercing. However, a lot of cannon ammunition wasn't designed to penetrate armour - they shells typically had bluntish noses to accommodate their fuses, and this isn't something really conducive to pushing through something like armoured glass. However, they did carry varying high explosive payloads, so there's the impact of a 10 grams or more of HE going off to consider, in addition to the kinetic energy of the round.
Also, you have to consider what could happen with multiple impacts. A Hurricane I or Spitfire I is putting ~9000 to 9400 rounds per minute down range - or about 150-160 rounds per second. A piece of armoured glass on a 109E is a small target, but if 150+ rounds a second are flying at you, the first might damage the glass and another lucky one or two hits actually penetrate it.