I am using a hp dv6000t laptop with a base install of Debian linux. It have a 256mb Geforce go 7400 nvidia graphics card. When I run my programs they get awful framerate. I have run some allegro examples and they all seem to run perfectly. It seems that just my programs lag. Why do they lag? It would be helpful if you told me exactly what to do as I am new to allegro and linux in general. I read somewhere that using DGA 2.0 drivers made it fast or something. I have tried that but it had a segmentation fault. Thanks for your help in advance.

On Linux, I don't think there is any hardware acceleration of Allegro programs, therefore, if you wish for your programs to perform better, the only advice I can give it to write better code. Look into dirty rectangles for updating the screen and make sure you only blit objects which will actually be displayed.

How big is the framerate difference compared to windows?What kind of bitmaps are you using (memory, system, video)? Are you using lots of fancy effects (blending, trasparency)?

__________In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de SnepscheutMMORPG's...Many Men Online Role Playing Girls - Radagar"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

When I run my programs they get awful framerate. I have run some allegro examples and they all seem to run perfectly. It seems that just my programs lag. Why do they lag?

Post code. We can't tell what's different between your program and Allegro's examples without seeing them.

Quote:

It would be helpful if you told me exactly what to do as I am new to allegro and linux in general.

Post code. We need to see what you're doing in order to be able to tell you if you're doing something wrong.

Quote:

I read somewhere that using DGA 2.0 drivers made it fast or something. I have tried that but it had a segmentation fault.

DGA 2 allows you to use hardware acceleration in X11, but it's officially deprecated (in X11, not Allegro itself). Note that the driver requires root privileges and will fail to initialise if it can't get them (meaning you get a segfault if you don't check the return value of set_gfx_mode).

As you can tell the following is a pong ripoff. Please excuse my global variables and other bad code. I noticed that it only lags when i draw shapes to the screen not bitmaps. On my computer it runs smoothly for three seconds and then lags sooo badly.

Loose the acquire/release screen functions and use regular blit to copy buffer to screen.

IIRC, acquire screen was good only when you had to access the screen bitmap several times per frame. Blitting buffer to screen does not qualify for such a situation.

You don't seem to be clearing the buffer each frame. Do you always redraw the entire screen every frame? From the code it doesn't look like that.

Also you might want to learn about allegro timers. Using only rest(1) for timing will not work for anyone else but you.

__________In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de SnepscheutMMORPG's...Many Men Online Role Playing Girls - Radagar"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

First off, get rid of all those acquire_screen()s. And as a side note, use blit instead of draw_sprite to copy the backbuffer to screen. Secondly, your desktop is likely running in 32-bit, so opening a 16-bit window may cause further slowdowns. On an unrelated but vital note, you don't seem to have any kind of timer logic.

__________In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de SnepscheutMMORPG's...Many Men Online Role Playing Girls - Radagar"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

You still haven't changed your color depth to 32-bit (assuming that's what your desktop is running). Also, are you running this as root? And, finally, make some proper timing logic. rest() is not a good way to do timing.

I compiled and tested your code and it ran rather nicely on my Linux box in both, 16bit and 32bit when my desktop was 32bit. I think it was around 200-400FPS. It might be because my CPU is quite a bit above the average though.

Also, do you know your rest() doesn't work at all? Problem is you don't install timers. Of cource rest() is not the thing to make your game play at decent framerate. Please learn about timers and proper frame rate keeping. You can start by reading this:http://www.allegro.cc/forums/thread/589396

__________In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de SnepscheutMMORPG's...Many Men Online Role Playing Girls - Radagar"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski