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 2 of 2

Thread: Using compressed and non compressed mipmaps

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Location
    Poland
    Posts
    13

    Using compressed and non compressed mipmaps

    Is it posible to use both compressed and uncompressed texture data when uploading mipmaps for texture ? I'm working on better streaming system for textures with seamless transition beetwen mipmap lvl's.
    So far so good. Everything working fine untill I'm uploading non compressed data using glTexImage. I'm setting GL_TEXTURE_MAX_LEVEL to the last (1x1) mipmap index but it seems that texture gets uncompletness when that happen. I'm forced to set GL_TEXTURE_MAX_LEVEL as the last compressed mipmap and then it works.

    My question : bcoz glTexImage doesnt return any GL Error, is it possible to use non compressed data with compressed in another mipmaps ( compressed data works great when te resolution is >= 16, i need <16 texture mipmaps to avoid aliasing ).


    Thanks for any help !

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,194
    Quote Originally Posted by Sagaceil View Post
    Is it posible to use both compressed and uncompressed texture data when uploading mipmaps for texture ?


    Yes.

    If you're doing texture streaming, you want to make sure you're pre-uploading the same data format as the GPU texture contains. For instance, if texture is LATC2, upload LATC2 compressed texture data. If DXT1, upload DXT1 compressed texture data. etc.

    If you don't care about performance, you can upload uncompressed data to a compressed texture, but you'll pay for it in performance as the driver has to compress the data in the process. I

    And for completeness, I don't know if you can (have never tried) uploading compressed data to an uncompressed texture. Should work, but why would you ever do this?

    Everything working fine untill I'm uploading non compressed data using glTexImage.


    That's one problem right there. *TexImage* = allocate and upload. *TexSubImage* = upload only. When you're doing texture streaming, you should have already allocated all of your textures. All you should be doing is just changing the content of existing textures.

    I'm forced to set GL_TEXTURE_MAX_LEVEL as the last compressed mipmap and then it works.
    I don't understand this. The internal format that you "allocate" for the texture MIPs should be consistent across all MIPs in a texture. In other words, use consistent glTexImage* or glCompressedTexImage* calls with the same internal format. If not, you'll have problems.

    Then, once you allocate all the MIPs, stream using glTexSubImage* (or glCompressedTexSubImage*).


    I believe the newer glTexStorage* APIs for allocating textures make this easier as IIRC you allocate the whole texture (all MIPs) at once, so there's less chance for errors in allocating the MIPs of a texture.
    Last edited by Dark Photon; 11-21-2013 at 07:10 PM.

Tags for this Thread

Posting Permissions

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