I am loading a RGBA texture which is 1024 x 1024. I expected the on-memory texture size would be 1024 x 1024 x 4 => 4 MB . But when I try to print the memory consumption I can see that the texture is taking around 7 - 8 MB, almost double. I was just wondering whether IPad is converting every channel from byte to half-float, So is there any way to specify that every pixel should take 4 bytes and not 8 bytes.
-
Are you sure you're not accidentally loading (or padding out to) a 2048x1024 texture? – bobobobo Feb 22 '13 at 14:22
2 Answers
The easiest way to specify it is using a sized internal format (like GL_RGBA8 instead of GL_RGBA), although I'm not sure if these are supported in ES. But I would be surprised if an ES device would store a standard RGBA texture with more than 8 bits per channel.
How do you determine the GPU memory consumption? I would rather guess the additional memory is due to other important GPU resources, like VBOs and not to forget the framebuffer itself (the memory you render into), that takes a reasonable amount of memory. And remember, when using mip-maps these additionally require around 33% of the base texture's memory.
And if you're talking about the size of the CPU data you create the texture from, then this doesn't have anything to do with the texture's size anyway and only depends on the size of your own data.

- 45,360
- 10
- 108
- 185
-
@downvoter Reason for the downvote? Ok, I might not be that fit in the hardware architecture of ES devices, but I would like to know, what was wrong in particular. Or maybe I misunderstood the question? – Christian Rau Oct 19 '11 at 18:54
You have to specify the type and internal format of your texture when you create it using glTexImage2D.
Yours is probably set to GL_FLOAT or something .
Lookup the documentation here : http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml

- 1,310
- 1
- 11
- 23
-
The type argument to glTexImage2D specifies the type of the CPU array to create the texture data from. It doesn't influence the data on the GPU, which is only dependent on the internal format. – Christian Rau Oct 18 '11 at 19:59
-