|
Problems porting to linux. Video crashes |
Lucas Dalmasso
Member #20,839
August 2021
|
Well, i tried to port my Allegro 5 app to linux and blum!! locked bitmaps pointers doesn't work. |
Arthur Kalliokoski
Second in Command
February 2005
|
You want al_put_pixel((int x, int y, ALLEGRO_COLOR color), not the al_putpixel() which is from allegro 4. They all watch too much MSNBC... they get ideas. |
Lucas Dalmasso
Member #20,839
August 2021
|
Sorry i meant al_put_pixel(). The one in current Allegro 5. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
There's nothing wrong with the pointer. Pitch may be negative. You have to account for that. Read over al_lock_bitmap and ALLEGRO_LOCKED_REGION. The formula for pixel x,y is : ALLEGRO_BITMAP* bmp = al_create_bitmap(480,360); ALLEGRO_LOCKED_REGION* lock = al_lock_bitmap(bmp , ALLEGRO_LOCK_READWRITE , ALLEGRO_PIXEL_FORMAT_RGBA); char* byte = lock->data + y*lock->pitch + 4*x + /*0,1,2,3*/; al_unlock_bitmap(bmp);
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Lucas Dalmasso
Member #20,839
August 2021
|
Ok, i have to fill all the screen starting from pixdel 0 to last pixel, so for the sake of doing it faster i only advance the pointer. Im not using X and Y coordinates (that's s why i wanted to do it that way), but it seems i cannot with a negative pitch. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
A multiply and an addition won't be significantly slower than just an increment, but it will be correct. And besides, that's the only correct way to do it. EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|