getTexImage crash

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, &wtex );
  glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_HEIGHT, &htex );
  glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_INTERNAL_FORMAT, &comp );
  glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_RED_SIZE, &rs );
  glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_GREEN_SIZE, &gs );
  glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_BLUE_SIZE, &bs );
  glGetTexLevelParameteriv( GL_TEXTURE_2D, subsample,GL_TEXTURE_ALPHA_SIZE, &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 << "	" << gs << "	" << bs << "	" << 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

Huh? How did you get a non-power-of-two texture into a GL_TEXTURE_2D target?

Your code will crash if wh is smaller than wtexhtex.

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

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

Oh, I forgot that one. I looked into GL_ATI_texture_float only.