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…

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?

Uhm, I’m confused, what physics functions are you referring to?

sorry …the functions other than related to graphics…

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…

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.

[QUOTE=carsten neumann;1250679]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.[/QUOTE]

Thanx for your reply. I will take care of the posting guidelines.