How to export verticies into .obj file format

I’m making CAD application as a school project. I can draw 2D groundplans and convert them into 3D models. My professor told me to implement exporting. Basically he wants me to implement class which would somehow store my OpenGL coordinates into some 3D file(.obj or something like that) so we can load these models into 3D printer. Is there any way how to do this ?

This doesn’t involve OpenGL. It involves taking the coordinates you would pass to glVertex or similar and writing them to an OBJ file, the format of which is described here. At a minimum, the file needs to contain “v” statements for the vertex positions and “f” statements to define the faces.

Thank you very much for that link to that site, I couldn’t find anywhere how to write .obj. I’ve already wrote part of the function which handle this and it works perfectly !