Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » load a big bmp

This thread is locked; no one can reply to it. rss feed Print
load a big bmp
Matheus Santos
Member #15,053
April 2013

I'm having trouble loading bmps great, I have bmp up to 33MB and I carry them in memory is too slow!

it is possible to load a bmp so great in video?

I have no video card.

ps: sorry for the English.

Dizzy Egg
Member #10,824
March 2009
avatar

it is possible to load a bmp so great in video?

I have no video card.

Mehehe.

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Matheus Santos
Member #15,053
April 2013

WHY AL4 LOAD THE BMP AND AL5 NO? '-'

Thomas Fjellstrom
Member #476
June 2000
avatar

Allegro 5 loads bitmaps into video memory by default, and is limited to the maximum texture size your video card is capable of. These days thats a maximum size of 4096x4096. You can override that by forcing new bitmaps to be system memory bitmaps by using al_set_new_bitmap_flags before creating or loading the large bitmaps.

And yes, you do have a video card, it just might be integrated into your computer.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matheus Santos
Member #15,053
April 2013

when I load a bitmap from memory the program is too slow, is this normal?

Thomas Fjellstrom
Member #476
June 2000
avatar

Completely normal. Memory bitmaps are slow, video bitmaps are (super) fast.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

usually, yes.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Matheus Santos
Member #15,053
April 2013

other question, i run the same program in allegro 4 and this is more faster than allegro 5... what allegro 4 have that allegro 5 dont?

Thomas Fjellstrom
Member #476
June 2000
avatar

Allegro 4's memory drawing code can be faster. But if you modify your program to work with how Allegro 5 wants things to work (split large bitmaps into smaller ones so you can load them into video memory), it'll be MUCH faster than Allegro 4, especially once you start using blending.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

n00b Question: that limit of squared 4096 pixels....how much raw data memory could actually be?

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Thomas Fjellstrom
Member #476
June 2000
avatar

If you mean how much memory a 4k texture would take, 4096 * 4096 * (bitdepth/8). For 32bit, thats 64MB.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

yes precisely!

I was asking just for confirmation, I was wondering if I got it right.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Elias
Member #358
May 2000

Also, memory bitmaps don't have to be slower. Just make sure to use only memory bitmaps (especially, also have the target bitmap be a memory bitmap and not the display backbuffer) and turn off blending (in A5 it's on by default).

--
"Either help out or stop whining" - Evert

Matheus Santos
Member #15,053
April 2013

how can I turn off the blender?

Thomas Fjellstrom
Member #476
June 2000
avatar

If you haven't enabled it, you're not using it.

I think your problem might be drawing a large memory bitmap to the display. which can be quite slow. Drawing into your memory bitmap should be nearly or as fast as Allegro 4.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matheus Santos
Member #15,053
April 2013

I load one big bmp and then put into an array of bitmaps (all in memory) and drawing in a buffer created in memory but still too slow

EDIT

All images was loaded in memory

Elias
Member #358
May 2000

To turn off blending, basically do something like:

al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO);

This should make al_draw_bitmap result into basically a memcpy per row.

--
"Either help out or stop whining" - Evert

Matheus Santos
Member #15,053
April 2013

now it's fast, but it has some images that are not being drawn... some ideia why?

Go to: