views:

74

answers:

1

I'm loading pixels from an image which is 32 w by 32 height. The format I'm loading them in is ARGB via java. When I bind this to the video card, I can expect that the video card might use somewhere around 32*32*4 bytes, or 4K.

Similarly, 1024 w, 1024 h would be 1024*1024*4 = 4MB.

Is my understanding correct? Now I understand where all the memory goes!

+1  A: 

The exact amount of memory used is not something that you will be able to compute because each implementation has its own (internal) constraints on textures. Amongst them:

  • alignment requirement for the base pointer(s)
  • constraints on the width and height
  • specific constraints on mip-maps (there are many potential ones here).

So in short, you can guestimate a lower-bound on memory usage, but you'd better add some room for additional stuff that each GL implementation might use.

(As a side note, mip-mapping is something you definitely should take into account. It adds at least 1/3 of the base layer if in use).

Bahbar
thanks bahbar, those are excellent points. @marcelo, sorta yeah. i just wanted to make sure i thought i knew what was going on.