allocedmem() for Graphics?

BlitzMax Forums/BlitzMax Programming/allocedmem() for Graphics?

Serge(Posted 2005) [#1]
How can i see how much graphic memory is alloced by my application? Didn't find anything in max2D.


Dreamora(Posted 2005) [#2]
You can't at the moment at least not with the standard functionality


Serge(Posted 2005) [#3]
Yeah but somehow with OpenGL maybe?


ImaginaryHuman(Posted 2005) [#4]
You could at least try to estimate it.

ie 800x600 32-bit display is probably RGBA, so..

800x600x4

gives you the size in bytes of one buffer

x2 for the double buffer?


Serge(Posted 2005) [#5]
Yes that wouldn't be a problem until i start to load some Images, what i'll do for sure ;)


Dreamora(Posted 2005) [#6]
You can calculate the size of a image in RAM ...

used_ram = widht * height * screen_depth

as there are not compressed textures in Max2D module which would influence this equation


skidracer(Posted 2005) [#7]
Screen depth does not influence images in Max, masked and alpha images take 4 bytes per pixel, others use 3 bytes per pixel of vidmem. There are also 1 byte per pixel formats only used by imagefont glyphs at this time.


FlameDuck(Posted 2005) [#8]
Save all your images in BMP format.


dmoc(Posted 2005) [#9]
BMP! Big and no alpha channel. PNG should be standard but if not then TGA.


FlameDuck(Posted 2005) [#10]
I agree. But since it (mostly) isn't compressed, it will give you a good indication of how much memory you will need. Keep in mind that knowing this, is somewhat futile since you have no way of checking whether said ammount of graphics memory actually exists.


xlsior(Posted 2005) [#11]
I agree. But since it (mostly) isn't compressed, it will give you a good indication of how much memory you will need


BMP uses RLE (run-time length encoding), which can actually be very efficient for images that use relatively few colors.

If you're talking about true-color photo's then yes, BMP is doesn't compress much... but the less actual colors you use, the better the compression gets. BMP filesize is not a good indication on how much actual memory the decompressed image would take up.


FlameDuck(Posted 2005) [#12]
BMP uses RLE (run-time length encoding), which can actually be very efficient for images that use relatively few colors.
Hench the mostly bit. Also BMP does not use Run Length Encoding by default. It can use (as an option) RLE to reduce the size of very large, palletized images. For any 24-bit image that contains no large all black or all white sequential areas however RLE is not going to do much to reduce your filesize.

but the less actual colors you use, the better the compression gets.
Only if you're using a paletteized image.

BMP filesize is not a good indication on how much actual memory the decompressed image would take up.
No. But it's better, and easier to understand than "nothing".