Using compressed and non compressed mipmaps

Started by
7 comments, last by Sagaceil 10 years, 4 months ago

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

Advertisement

The specification requires all mipmaps to have the same internal format.

So actually theres no way to use compressed textures and use lower size than 4px. I supposue that compression require 4x4 px blocks to be compressed.

There's no problem using compression for non-multiples of 4x4 blocks. Many, if not all, compression formats works just fine with any texture size.


Many, if not all, compression formats works just fine with any texture size.

That would be nice, but is it so? I've found contradictory statements about the ability to compress NPOT textures.

My last own tests regarding this issue were done with OpenGL 2.1 on Mac OS 10.6, and at that time using GL_RGB as external format and GL_COMPRESSED_RGB as internal format to glTexImage2D has led to internal format GL_RGB8 for a rectangular texture, regardless whether its size was a multiple of 4 in both dimensions or not. The same image but padded to square POT size then led to GL_COMPRESSED_RGB_S3TC_DXT1 internal format.

The ARB_texture_rectangle stated that glTexImage is allowed to do what is shown by mentioned tests. It further stated that glCompressedTexImage is not supported for rectangular textures, although there is room for enhanced formats: "This is because several existing hardware implementations of texture compression formats such as S3TC are not designed for compressing rectangular textures. This does not preclude future texture compression extensions from supporting compressed internal formats that do work with rectangular extensions ..."

And the specification for OpenGL 4.4 core profile states in section 8.7: "... except that compressed rectangle texture formats are not supported."

On the other hand I've read somewhere that it is actually found that some implementations actually do accept pre-compressed rectangular textures, although even it may be that they do not compress such textures themselves.

Very confusing ...

I have no problems with odd-sized texture compression, they load just fine. I get compressed internal formats for odd-sized textures with uncompressed and compressed source data and with a generic and a specific compressed internal format.

You keep talking about texture rectangles though, they have some general limitations as far as I remember. I have never used them so don't know how they interact with texture compression and if there are some additional requirements.

Ok, solved.

I'm uploading compressed mipmaps using glCompressedTex* ( mipmaps with size >= 4px ) and using glTexImage* with GL_COMPRESSED_RGB(A) for lower mipmaps.

Just curious, why aren't you using the same for methods for mipmaps less than 4 pixels? I don't know the internal format is supposed to be chosen for a generic format, but chances are that the explicit format you use for images larger than 4 pixels just happens to be the same as the generic format for images smaller than 4 pixels. If the driver cannot use the same format for the generic one, your approach till fail.

When Im importing textures to engine, Im doing offline compression using close fit range compression. So I have to ananlize whole 4x4 blocks as an input. When loading textures , they are in compressed format arleady, and the last mipmaps are stored as a raw RGB(A) data.

This topic is closed to new replies.

Advertisement