Allegro 4.2 Slow on Windows 7
Mike Geig

Hello everyone, I need to run Allegro 4.2 for legacy and I am running Windows 7 32-bit. The programs run super slow and are prone to crashing. The same programs run fine in Windows XP and on another Windows 7 box (64 bit). Any ideas what I can do to fix my issue?

LennyLen

The problem might be caused by badly written code, so perhaps you should post it.

Mike Geig

Well, I doubt it since it is a simple demo app:

#SelectExpand
1#include <stdlib.h> 2#include <allegro.h> 3 4int main(void) 5{ 6 allegro_init(); 7 set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); 8 install_keyboard(); 9 10 while(!key[KEY_ESC]) 11 { 12 rectfill(screen, 320, 240, 340, 360, 15); 13 } 14 allegro_exit(); 15} 16END_OF_MAIN();

Matthew Leverton

How do you know that runs slowly? It's not doing anything... Does it crash?

Do you always use 8-bit graphics? Those are known to not work well under Windows 7.

The best way to get good performance is:

set_color_depth(desktop_color_depth());

Also, Allegro 4.4 might work better. It's source compatible with 4.2.

One last thing, make sure the Allegro libraries/binaries you use are for your specific compiler version (not a problem if you built it yourself) and that you use the same C or assembly settings during build, as mixing those can cause crashes.

Mike Geig

Thanks Matthew, setting the color depth made the program work great. The only problem there is that my primitives are rendered a very dark, almost black color no matter what color I pass in for them.

Any ideas?

Edgar Reynaldo

Try using makecol instead of passing 15 as the color?

Matthew Leverton

When using anything higher than 8-bit color depth, you have to use makecol to get the proper integer representation of a color. (8-bit uses an indexed palette.)

makecol(255,255,255) is white.

As an aside, when using 8-bit mode under Windows, the GFX_GDI driver is probably the most compatible.

Thread #606521. Printed from Allegro.cc