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