Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: glGetTexImage for integer

  1. #1
    Junior Member Newbie
    Join Date
    May 2007
    Posts
    4

    glGetTexImage for integer

    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.)

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: glGetTexImage for integer

    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....?

  3. #3
    Junior Member Newbie
    Join Date
    May 2007
    Posts
    4

    Re: glGetTexImage for integer

    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:

    Code :
      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_RGBA_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_INTEGER_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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •