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 ! :slight_smile:

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.