NVIDIA glTexImage3D problems

Hi!

glTexImage3D crashes for certain sizes, for example the following code will crash:


int width = 65;
int height = 64;
int depth = 64;
int size = width * height * depth;
byte *data = new byte[size];
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_3D, tex);
glTexImage3D(GL_TEXTURE_3D, 0, GL_R8, 
             width, height, depth, 0, GL_RED, GL_UNSIGNED_BYTE, data);

It’s totally weird, it is ok for width= 63, 64 and 67 but it crashes for 65 and 66.
I think when it is divisible by 4 then it’s ok, but not always crashes when it’s not divisable by 4.

Configuration:
ForceWare 266.58
GTX 285
Vista 64 bit

Try this:
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

ref: http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/ , section "7. Watch Your Pixel Store Alignment

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.