PDA

View Full Version : Comparing SDL vs. GLUT's looping system


Jones
2006.07.02, 02:09 PM
This is not an argument about which is better, SDL or GLUT. I just need some help wrapping my head around how glut's self loop system works, compared to say a simple SDL game loop.

If I were to do a game in SDL, my game loop would probably just be...

int isItTimeToQuit = 0;
while (isItTimeToQuit != 1) ... and so on...


But in GLUT, I can't just do that. Or at least I don't think I can...

When using GLUT, as far as I know. It (glut) will automatically just loop whatever you define as being the display, idle functions or keyboard functions etc etc. And this lopp begins with the glutMainLoop(); function. Now, would I just jam all the stuff that would normally be in my game loop in say, SDL, into my display or idle functions? Is it some kind of threading system in the background, ie Display and another function run at the same time?

Sorry, but this is something I need to know. :)

Thanks!

OneSadCookie
2006.07.02, 05:39 PM
Yes, anything that you would put in the body of your SDL loop, you should put into display or idle. No, there's no threading going on.

Jones
2006.07.02, 07:10 PM
Thanks! It just seemed strange and a but untidy to jam all my junk into my display loop.