Pass parameter to function related with glutDisplayFunc
My name is Jane Liu. I hope somebady can help me on my openGl project. In my program, I have a function void vis £®void£©, and I call glutDisplayFunc(vis) and glutMainLoop() to render the objects. Everything works fine. But somehow, the project requires me to pass a pointer as argument to the vis funtion, which violate the prototype of glutDisplayFunc and glutMianLoop rotine. Is there any way to render the objects without calling glutDisplayFunc and glutMianLoop rotine? Or call them but with a parameter passing vis?
I don't know how I can do this parameter passing issue, and already spend a lot time to try to solve the problem.
Can anyone help? Thanks.
Re: Pass parameter to function related with glutDisplayFunc
the purpose of glutMainLoop is to get the messages from the windows system and do the required action. If a "window needs to be redrawn" message arrives so is the glutDisplayFunc called. Its something at a higher level calling the actual lower level redraw functions.
Store all needed data in classes or as global variables depending on the language. Its a much nicer and cleaner solution.