how to pass information to draw function()

I have developed a C++ program which calculate coordinates for number of points. Now I want to display the points using openGL. In the openGL examples I have gone through, there is no mention of passing information to draw() function from the function which calls it. All the examples contain draw() as a top level function which calls other functions(which themselves contain the whole logic). In my case, one of the functions will calculate the coordinates for points and these points should get displayed. How can I pass the coordinates to draw() so that it would be accessible to draw funcion?

How are you calling the draw() function?

If you use GLUT, then there is no other way than to use a global variable or use the singleton design pattern. I recommend using SDL or writing the windowing code yourself, then you can pass whatever you want to the draw function or even call a C++ draw method…