Segmentation error with glTexImage3D


I need help you.

I am recovering pixels value of a image, 16 bits, single value, when I load a data to graphics card, I have a segmentation error.

My code is:

glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, width, heigth, depth, 0, GL_LUMINANCE,GL_UNSIGNED_SHORT , vol);

this parameters are, width, heigth, dept, and vol,

any suggestion? I was intended to load the data as LUMINANCE or INTENSITY, but also gives me error.


are you sure vol is big enough ?
4widthheight*depth bytes ?

Doesnt luminance take single component?
There could be also the thing with pack/unpack alignment being 4 by default (depending on the texture dimensions).

Yes, my bad, I stopped at the internal format GL_RGBA (why not GL_LUMINANCE8 by the way ?), the *4 should not be here.

And you are right, default alignment is 4 bytes, so that can matter if the 3D texture is non-power-of-two.

Try this otherwise :
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);

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