Yes it is ok to dry fire your Glock. FYI: If you ever plan to remove the slide from the frame it is mandatory.
Dry fire your Glock often! Dry fire helps wear in the trigger parts and results in a smooth action. It is also the best practice of trigger control you will ever get. Keep on dry firing until you see absolutely NO front sight movement. When you accomplish this, run out to the range and shoot a few groups. You will be amazed you can actually produce "tight little bundles of holes in the same area"