Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Pass parameter to function related with glutDisplayFunc

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2003
    Location
    Houston, TX
    Posts
    10

    Pass parameter to function related with glutDisplayFunc

    Hello,
    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.

  2. #2
    Guest

    Re: Pass parameter to function related with glutDisplayFunc

    Hi Jane,
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •