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: Using TexStorage correctly or is this a bug?

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    14

    Using TexStorage correctly or is this a bug?

    I'm trying to compress a texture to BPTC using this code but I am getting a corrupted image.

    Code :
    glTextureStorage2DEXT(texture, GL_TEXTURE_2D, 10, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, 512, 512);
    glTextureSubImage2DEXT(texture, GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_RGBA, GL_UNSIGNED_BYTE, image_buffer);

    On the other had, if I use this it works.

    Code :
    glTextureImage2DEXT(texture, GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_buffer);

    Also, if I do this:

    Code :
    glTextureStorage2DEXT(texture, GL_TEXTURE_2D, 10, GL_SRGB8_ALPHA8, 512, 512);
    glTextureSubImage2DEXT(texture, GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_RGBA, GL_UNSIGNED_BYTE, image_buffer);

    My texture appears overexposed, but if I do this:

    Code :
    glTextureImage2DEXT(texture, GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_buffer);

    It appears correctly.

    For the record, glGetError and KHR_debug report no errors and nothing changes if I used the non-direct_state_access versions of these functions. Can somebody please tell me if I am using these functions incorrectly or if this is a driver bug.

  2. #2
    Junior Member Regular Contributor tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    224
    Have you tried with the non-DSA version of TexStorage? Since the DSA version is not in the GL core, it is likely less tested.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    14
    It's not a DSA related issue. It effects glTexStorage2D just as much as glTextureStorage2DEXT.

    I decided to use glGetTexLevelParameteriv to actually check the internal format of the texture after creation. When I create the texture with glTexImage2D and GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, glGetTexLevelParameteriv comes back with a format of GL_SRGB_ALPHA. If I create the texture with glTexStorage2D and GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, glGetTexLevelParameteriv comes back with a format of GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, but of course if I use glTexSubImage2D on it, it ends up corrupted (colorful noise). I tried GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT. glTexImage2D seems to work fine. It says the texture is actually S3TC. glTexStorage2D is also able to handle it, without corrupting the image, but as with GL_SRGB8_ALPHA8 the image comes out looking overexposed, as if it is being treated as linear data.

Posting Permissions

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