开发者

Is it possible to use custom mipmap sizes?

i am currently working on some kind of virtual texture implementation. The mipmap level开发者_如何学Gos are used as a level of detail controlling structure. (Every texel in the virtual texture relates to a block of data in the 'real' texture.)

The data exists in several detail levels which result in different block counts in the virtual texture.

Example:

level       size of data       number of blocks
0           60                 4
1           30                 2
2           15                 1

My idea was to call glTexImage for every detail level in the virtual texture to create the different mipmap levels.

The problem is that altough there are no errors when creating or updating/loading i can't get any data from the texture. Creating only the base level and calling glGenerateMipmap works fine but results in the wrong sizes for some base sizes. (technically they are correct, but not in my case)

I read somewhere that mipmap level sizes must be a division by two (or by two and floor).

The questions:

  • Is it possible to load 'custom' mipmap levels?
  • Are there any constrains mipmap level sizes?


You can load custom mipmap levels, but cannot choose their sizes. OpenGL specifies what MipMap sizes for levels it expects and does not allow deviation from it.

Taking width as example, the required width for mipmap level i is max(1, floor(w_b / 2^i)), where w_b is the width of the first mip level (the base). It is the same for the other dimensions (GL spec 2.1, section 3.8.8, paragraph mipmapping).


Make sure you loaded mipmap levels all the way down to 1x1. See here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜