![]() |
|
Runtime problem |
Kevin Adrian
Member #7,087
April 2006
![]() |
I've written an Allegro game for the Linux OS. It runs fast and without problems. Now I'm going to compile this game for Windows. I could compile and link it successfully, but the game runs very slowly. I've already tried to set GFX_DIRECTX instead of GFX_AUTODETECT_FULLSCREEN, but that didn't solve the problem. I hope somebody can help me. My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3) |
gnolam
Member #2,030
March 2002
![]() |
Show code. -- |
GullRaDriel
Member #3,861
September 2003
![]() |
I second Gnolam, but you could start with some things before: Check your GFX driver, are they up to date ? Tell us: Your windows version Make a virus scan (hé, you are under windows, you never know ;-) ) Thanks. "Code is like shit - it only smells if it is not yours" |
Kevin Adrian
Member #7,087
April 2006
![]() |
OS: Windows98 I've changed some things in my program, now it runs a little bit faster but even not satisfiable. My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3) |
Audric
Member #907
January 2001
|
This should have noticeable effects : acquire_bitmap() manual said: locking a DirectDraw surface is very slow, so you will get much better performance if you acquire the screen just once at the start of your main redraw function, and only release it when the drawing is completely finished
|
Kitty Cat
Member #2,815
October 2002
![]() |
For better or worse. Used properly it may give you a boost, used improperly it will slow everything down (or worse). -- |
Kris Asick
Member #1,424
July 2001
|
My best guess, since you're switching from Linux to Windows, is that you're drawing each of your individual objects to the screen or a video bitmap without locking the memory using acquire_bitmap() and release_bitmap(). DirectX in Windows, like anything in Windows, does a ton of memory swapping, so in order to make large changes to a bitmap being accessed by the video card, it needs to lock the memory first, make its writes, then unlock it. Now, Allegro will do this locking and unlocking for you automatically, but will do it EVERY time you draw to a video memory surface if you haven't locked it manually. So what you need to do is draw everything to a regular Allegro bitmap, then draw that bitmap to the screen each frame, OR put all your screen rendering code together, lock the screen, draw everything, unlock. Be careful you don't do anything besides rendering between locking and unlocking a piece of video memory or the screen. If you do you could lock up or crash your program. (Or the system.) --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
Kevin Adrian
Member #7,087
April 2006
![]() |
Thank you for your help. Now my game runs without problems. My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3) |
|