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

Thread: Glut Callbacks.....

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    23

    Glut Callbacks.....

    hello everyone....this may be a very basic question but I was wondering that whether the sequence in which we register our glut callbacks matter....when the program enters glut main loop which function is executed first....?
    thanx a lot...

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    720
    The order you register callbacks in has no influence on the order the callbacks are being called, the latter is determined by the order in which GLUT receives events from the window system. IIRC you usually get one or more calls to the reshape callback before the first invocation of the display callback. I'm not sure this is guaranteed though and I would not be surprised if it differs between platforms.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    23
    Quote Originally Posted by carsten neumann View Post
    The order you register callbacks in has no influence on the order the callbacks are being called, the latter is determined by the order in which GLUT receives events from the window system. IIRC you usually get one or more calls to the reshape callback before the first invocation of the display callback. I'm not sure this is guaranteed though and I would not be surprised if it differs between platforms.
    So I guess the order is reshape function then display then the other physics functions... am i right?

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    720
    Uhm, I'm confused, what physics functions are you referring to?

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    23
    Quote Originally Posted by carsten neumann View Post
    Uhm, I'm confused, what physics functions are you referring to?
    sorry ....the functions other than related to graphics.....

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    720
    Ok. Well, as mentioned before it really depends on the order of window system/OS events. About the only guarantee there is is that you get at least one call to reshape before the first call to display (see glutReshapeFunc), writing code that relies on anything more than that seems like asking for trouble. Why is the order of callback invocation important to you?

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    23
    Quote Originally Posted by carsten neumann View Post
    Ok. Well, as mentioned before it really depends on the order of window system/OS events. About the only guarantee there is is that you get at least one call to reshape before the first call to display (see glutReshapeFunc), writing code that relies on anything more than that seems like asking for trouble. Why is the order of callback invocation important to you?
    thanx for ur reply......i have a program which has got lots of functions(graphics and non-graphics)...so for understanding the execution of it i needed to understand the order....
    actually it is a machining simulator in which the workpiece is represented using grasses(vectors) and the intersection between the tool swept volume and grasses updates the vector data and in this way we simulate the machining being done....and the thing is its quiet slow i need to improve its speed....do u have any idea about this or examples??...
    thanx again...

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    720
    For any kind of performance optimisation you will first have to understand what parts of your program are slow, i.e. you'll have to profile it so that you know where to spent your time/brainpower best. General profiling/optimization is a bit out of scope (and off-topic) for this forum, but you should be able to find some tutorials/guidelines online. If you end up determining your graphics are a bottleneck, this forum is of course a good place to ask for advice, but be sure to have a very good understanding how the graphics in your program work, people will ask about that, since otherwise they will not be able to give useful advice.

    PS: Please be considerate of the readers of your posts and try to watch the formatting, single "." after sentences, start with capital letters, etc. These things make the post easier to read and understand and increase the chance of getting useful answers - for additional suggestions see the Forum Posting Guidelines.

  9. #9
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    23
    Quote Originally Posted by carsten neumann View Post
    For any kind of performance optimisation you will first have to understand what parts of your program are slow, i.e. you'll have to profile it so that you know where to spent your time/brainpower best. General profiling/optimization is a bit out of scope (and off-topic) for this forum, but you should be able to find some tutorials/guidelines online. If you end up determining your graphics are a bottleneck, this forum is of course a good place to ask for advice, but be sure to have a very good understanding how the graphics in your program work, people will ask about that, since otherwise they will not be able to give useful advice.

    PS: Please be considerate of the readers of your posts and try to watch the formatting, single "." after sentences, start with capital letters, etc. These things make the post easier to read and understand and increase the chance of getting useful answers - for additional suggestions see the Forum Posting Guidelines.
    Thanx for your reply. I will take care of the posting guidelines.

Posting Permissions

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