PDA

View Full Version : GPU minimal texture size



MitchVL
05-26-2011, 03:53 AM
Hey everyone,

I am using glGetTexImage() to fill a buffer with texture information. When using textures smaller than 512x512, I found out that the buffer is being filled as if it was a 512x512 texture, filling excess pixels with '0'. so a 4x4 texture filled with only '1' will look like this:

x 0 1 2 3 4 5 6 ... 511
0 1 1 1 1 0 0 0 ... 0
1 1 1 1 1 0 0 0 ... 0
2 1 1 1 1 0 0 0 ... 0
3 1 1 1 1 0 0 0 ... 0
4 0 0 0 0 0 0 0 ... 0
5 0 0 0 0 0 0 0 ... 0
6 0 0 0 0 0 0 0 ... 0
. . . . . . . .



The function glGetTexLevelParameteriv always give me the original texture size as expected, so that does not help.

This is annoying because i don't know if it is standard behaviour that 512x512 is a minimum size ... is it ? where? is it GPU dependent? I need a way to predict the buffer size. Is there any way to do this ?

Thanks for your help

Cheers
Mitch

edit: Im also using PBO's, to which i stream texture data, and i do not have the same problem there. I can create 64x64 buffers for 64x64 textures, and stream them to the GPU.

_arts_
05-26-2011, 04:10 AM
How could you know that the data are filled for 512*512 pixels texture ?

To my opinion you make a mistake, just because this would lead in an awful memory consumption (think about mipmaps for examples).

Dan Bartlett
05-26-2011, 04:49 AM
Have you modified the pixel-store parameters from their initial values?
eg.
glPixelStorei(GL_PACK_ROW_LENGTH, 512); wouuld produce a similar effect to what you're getting.

MitchVL
05-26-2011, 05:07 AM
That's it ! thanks ! I forgot to reset those :) ugh