to beoran :
Ok, but please don't run away yet, and try to listen to what the people are saying here... I know you're young and restless, but you should take some time to get to know the libraries you are going to use, whether it is Allegro 5 or not.
As other people are telling you can write directly to a bitmap in allegro 5 as well, and then draw that to the display. There's a thread here with more info: https://www.allegro.cc/forums/thread/612922
With contemporary systems it's normally not possible anymore to switch the screen to such a full screen low resolution. In stead, you scale up your 320x240 buffer to screen size using transformations or by rendering the bitmap scaled. SDL 2 actually does the same.
Also, a different approach might be to not draw pixels, but simply draw colored rectangles of the right size to simulate pixels.
Sorry I know that. As I said, I have already tested the purposed methods... and this is so slow that I cannot stop laughing .
" Actually it will be slower because dosbox runs on SDL... Might as well use SDL or Allegro directly. "
Oug ! What a joke ! maybe written with SDL but it will be a lot faster !
to Thomas Fjellstrom :
I suggest you to read my post again :
I wrote :
"[...]anyway there is no problem because I can put a 640*480 with a 320*240 by duplicate value of the pixel[...]"
I am sorry but I don't stay with a library that allows me not to do what I want...
to polybios and pkrcel
Can you post a proof of what you are saying ? It will maybe change my opinion, because in fact I just need to display my bitmap without locking/unlocking each frame. I already tried but I admit that my previos code may be wrong but this one wroks, just tell me how much time you execute this program, it takes 45 secs on my computer and works on a single 3.00 ghz core :
int main(int argc, char **argv)
ALLEGRO_DISPLAY *display = NULL;
fprintf(stderr, "failed to initialize allegro!\n");
display = al_create_display(320, 200);
fprintf(stderr, "failed to create display!\n");
ALLEGRO_BITMAP *my_screen = NULL;
my_screen = al_get_backbuffer(display);
const int screen_pixels = 320*200;
int i, j, w;
ALLEGRO_LOCKED_REGION *lr = al_lock_bitmap(my_screen, ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_WRITEONLY);
unsigned int *ptr = (unsigned int *)lr->data; //points to first pixel
for (i=0; i<screen_pixels; i++)
I never intended to use int 10h functions, just read carefully my post...
Obiously, if there are not modified there are too slow...
I think that when I will launch my program through dosbox, I may loose 10% compared on if I boot on the programm but in fact I don't really know... And yeah 2^20 of memory is enough for me !
to Arthur Kalliokoski
Of course !