View Full Version : how to pass information to draw function()

09-10-2005, 03:52 AM
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?

09-10-2005, 06:02 AM
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...