PDA

View Full Version : getTexImage crash



-NiCo-
09-01-2004, 01:39 AM
Hi all,

I'm trying to read out a 32bit floating point texture on a gf6800 GT.

Here is the code I use:

GLfloat* depthLUT = new GLfloat[w*h*4];

cerr << "w = " << w << endl;
cerr << "h = " << h << endl;
cerr << "subsample = " << subsample << endl;

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D,textures[0]);

cerr << "istexture = " << (glIsTexture(textures[0]) ? "true" : "false") << endl;

GLint wtex,htex,comp,rs,gs,bs,as;
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_WIDTH, &amp;wtex );
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_HEIGHT, &amp;htex );
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_INTERNAL_FORMAT, &amp;comp );
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_RED_SIZE, &amp;rs );
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_GREEN_SIZE, &amp;gs );
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_BLUE_SIZE, &amp;bs );
glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_ALPHA_SIZE, &amp;as );

cerr << "wtex = " << wtex << endl;
cerr << "htex = " << htex << endl;
cerr << "iformat = " << comp << endl;
cerr << "check iformat = " << GL_RGBA_FLOAT32_ATI << endl;
cerr << "component sizes = " << rs << "\t" << gs << "\t" << bs << "\t" << as << endl;

glGetTexImage(GL_TEXTURE_2D,subsample, GL_RGBA, GL_FLOAT,depthLUT);The console output:

w = 720
h = 576
subsample = 0
istexture = true
wtex = 720
htex = 576
iformat = 34836
check iformat = 34836
component sizes = 32 32 32 32

Why does it crash at the getTexImage call? Removing this call does not cause a crash.

Greetz,

Nico

Relic
09-01-2004, 02:29 AM
Huh? How did you get a non-power-of-two texture into a GL_TEXTURE_2D target?

Your code will crash if w*h is smaller than wtex*htex.

Check the glPixelStore values.
Did the new succeed?
Is depthLUT a valid pointer?
Out of memory?
Where's the delete depthLUT?

-NiCo-
09-01-2004, 02:37 AM
Thanks for the reply Relic.

GF6800 are able to use non power of 2 textures through the GL_ARB_texture_non_power_of_two extension.

Everything in the code I posted works fine.
Eventually I found that I left a buffer object binding to GL_PIXEL_PACK_BUFFER_EXT hanging before the call to getteximage.

Nico

Relic
09-01-2004, 02:47 AM
Oh, I forgot that one. I looked into GL_ATI_texture_float only.