Archived

This topic is now archived and is closed to further replies.

NaliXL

My framework is OK, but keeps the PC quite busy

Recommended Posts

Hi there, So, I''ve written the beginning of an OpenGL framework myself, in Borland Delphi personal edition 6. Did this because Marc Aart''s delphi-conversion of NeHe''s tutor used MFC code, and I wanted to use standard borland-code. Works quite OK, in this way that it initializes OpenGL, and displays things correctley. There''s just one problem from which I can''t find what I''m doing wrong. In Marc Aarts and NeHe''s version, he uses a loop in the WinMain function that keeps the screen updating every time. I do about the same, but I have made this loop in the formcreate procedure. This works quite well, except for the fact that my program seems to be so busy with this loop, that it can''t find any free time for other things. So I can''t resize my form (gives a busy-cursor), it won''t respond to keydown and keyup events etc. etc. I''m not 100% but quite sure that it''s this loop that''s causing it. Can anyone tell me what I''ve missed in NeHe''s tutors? Or if I didn''t miss anything, at least how I can fix this problem? Thanks a lot!

Share this post


Link to post
Share on other sites
Provide an event handler for the Application.OnIdle event. In the handler, set the Done parameter to False and you have yourself the same loop that those WinMain procedures have. OnIdle is triggered from within the message loop. If you set the Done parameter to False then it is constantly triggered while there are no messages queued.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios

Share this post


Link to post
Share on other sites
DONT USE TIMERS!!!!!!

*g* Quake3 doesn''t use timers, Unreal Tournament doesn''t use timers and Max Payne doesn''t use timers and GAMES DONT USE TIMERS!!!

Ok that''s a sweeping statement - I don''t know for -sure- that they dont use timers... But I can safely assume!!! Timers fire messages at your application, when your app gets a timer message it processes the game loop, but the problem is that if your app isn''t running fast enough, it can get bogged down with timer messages and it generally sux...

I dont know what the equivalent would be in Delphi, but in VB I would put an infinite loop in the form load procedure which simply processed messages imbetween game cycles

Share this post


Link to post
Share on other sites