Oxygen is generated during photosynthesis by plants and many types of microbes. Plants both use oxygen (during respiration) and produce it (via photosynthesis). Oxygen can also form a molecule of three atoms, which is known as ozone (O3).
Explanation:
The oxygen in the glucose molecule comes from the carbon dioxide, which is used in the Calvin Cycle. As you mentioned, the oxygen in water is broken down in the non-cyclic phosphorylation process to obtain an electron which can be used in the photosystem I and II to form ATP and NADPH.