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 5 of 5

Thread: renderfunc questions

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    26

    renderfunc questions

    hy there

    i call my renderfunction as follows

    glutDisplayFunc(renderfunc);

    now i want to give me renderfunc some parameters

    glutDisplayFunc(renderfunc(foo,bar));

    but this wont work...how can i do a parametric function? w/o making variables global?

    bye

    apo

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2003
    Location
    Toulouse, France
    Posts
    133

    Re: renderfunc questions

    glut don't allow you to do that. to use parameters in the display function(or idle, reshape ...) you have to use global variables.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    26

    Re: renderfunc questions

    is there a good reason why this isnt implemented?

    hmm...ive done it w/o globals , i used a "fake" render function that does only the following in my case...

    void renderFunc(void)
    {
    displayCallback(32,32);
    }

    it works

    bye

    apo

  4. #4
    Junior Member Regular Contributor
    Join Date
    Apr 2003
    Location
    Toulouse, France
    Posts
    133

    Re: renderfunc questions

    the reason is ... there is probably no reason.
    your solution works well but your parameters won't stay static. so you'll have to use global vars to access them.

    maybe you should try another window "manager". try SDL.
    SDL don't have an implemented main loop, you have to code it. it's you who call the display func so you can pass parameters to the callback.

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    26

    Re: renderfunc questions

    i know...thats the reason why i wrote my fake func above the render func so u can see the relationship between this both

    bye

    apo

Posting Permissions

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