Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Mipmaps fade out completely at scales of 0.5 or less.

This thread is locked; no one can reply to it. rss feed Print
Mipmaps fade out completely at scales of 0.5 or less.
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Hello, here I have an image of some bitmaps rendered with mipmapping enabled. In the demo you can see that when you scale down the image, the bitmaps created with ALLEGRO_MIPMAP fade out and disappear at scales of 0.5 or less.

{"name":"611584","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/f\/1f014b12526cae791b4a87fa7f5b9147.png","w":1202,"h":933,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/f\/1f014b12526cae791b4a87fa7f5b9147"}611584
https://www.allegro.cc/files/attachment/611584
MinMagMipMap.zip

Frank Drebin
Member #2,987
December 2002
avatar

I am not sure if I can help you but I can tell that I can't open the attached zip-file :P

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Sorry, it was saved as a .7z with a .zip extension for some reason :P

MinMagMipMap.zip

EDIT
I think I found one the problem. The mipmap is not being re-generated when the source bitmap is redrawn. The mipmaps are dirty.

Updated demo that shows the bottom left mipmapped sprite being created with al_load_bitmap, and the right one that has been al_create_bitmap'ed and drawn on.

MipMapLoadedVsDrawn.zip

https://www.allegro.cc/files/attachment/611589
{"name":"611589","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/6\/9632d0c822e5462baadaab3d124e20b5.png","w":1202,"h":933,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/6\/9632d0c822e5462baadaab3d124e20b5"}611589

Frank Drebin
Member #2,987
December 2002
avatar

I can confirm that it works now. However, I don't see why. You will draw the 'bmp' bitmap that holds the loaded image to each 'buf[i]' bitmap. Why does it matter if 'buf[3]' is created by al_create_bitmap or by al_load_bitmap beforehand?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Elias
Member #358
May 2000

Does ex_filter work for you (i.e. no fading happens in the mipmap case)? If yes, do you have a guess what the problem could be?

[edit:] Oh, missed your edit above. That does sound like it is the issue... so we do need to re-create the mipmaps in some cases. Or document that they will not update automatically.

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

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I can verify ex_filter works both for the checkerboard and the mysha image.

{"name":"611595","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/7\/2791abf464516ee11b5cf8864d170506.png","w":642,"h":513,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/7\/2791abf464516ee11b5cf8864d170506"}611595{"name":"611596","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/c\/fcb85601ce0b05b5bf1a1dbf0c8c0a23.png","w":642,"h":513,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/c\/fcb85601ce0b05b5bf1a1dbf0c8c0a23"}611596

Well, the mipmaps are dirty and they're not being updated. When does allegro re-upload dirty bitmaps?

EDIT for your edit
al_update_mipmaps(bmp); ftw!

Go to: