PDA

View Full Version : glGetTexImage for integer



Zvetiki
05-06-2007, 01:58 AM
I have an 8800 GTX and an integer texture. (To be precise: created with glTexImage2D with target=GL_TEXTURE_RECTANGLE_NV, internalformat=GL_RGBA32I_EXT, format=GL_RGBA_INTEGER_EXT, type=GL_INT.) I can use this texture in fragment programs, I can bind this texture as a framebuffer and everything works OK.

The problem is: I cannot download data from it with glGetTexImage. Whatever I tried for the format or type arguments, I get an "invalid operation". (The call context is not the problem, because download from float textures works in the same situation.) So what are the correct enumerants?

(Tried under various driver version, current 158.22 on XP-32.)

dorbie
05-07-2007, 02:00 AM
Have you checked for other possible prohibitions?

Also make sure that you're not between a begin end draw pair and that the intended target is bound and. You don't mention MIP lod....?

Zvetiki
05-07-2007, 02:31 AM
Have you checked for other possible prohibitions?

Also make sure that you're not between a begin end draw pair and that the intended target is bound and. You don't mention MIP lod....?I try the download immediately after the upload, and level==0:


GLuint texture;
GLfloat test[4] = {2,3,4,5}, out[4];
//GLint test[4] = {2,3,4,5}, out[4];
glGenTextures(1,&texture);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV,texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV,0,GL_FLOAT_RG BA_NV,1,1,0,GL_RGBA,GL_FLOAT,test);
//glTexImage2D(GL_TEXTURE_RECTANGLE_NV,0,GL_RGBA32I_ EXT,1,1,0,GL_RGBA_INTEGER_EXT,GL_INT,test);
assert(glGetError()==GL_NO_ERROR);
glGetTexImage(GL_TEXTURE_RECTANGLE_NV,0,GL_RGBA,GL _FLOAT,out);
//glGetTexImage(GL_TEXTURE_RECTANGLE_NV,0,GL_RGBA_IN TEGER_EXT,GL_INT,out);
assert(glGetError()==GL_NO_ERROR);
assert(test[0]==out[0] && test[1]==out[1] && test[2]==out[2] && test[3]==out[3]);In this state, that is, with the floating point textures, everything works correctly. The integer code path fails at the glGetTexImage call (0x502, which is invalid operation). The generated texture, however, can be used by fragment programs, so I know that the set up has worked correctly. It seems that just the download is broken.