tags:

views:

32

answers:

2

Hi everybody,

i am currently working on some kind of virtual texture implementation. The mipmap levels 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?
A: 

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

genpfault
Just tried that ... but it gives me the blank screen nevertheless.Mipmap sizes generated by glGenerateMipmaps:(26, 32, 16), (13, 16, 8), (6, 8, 4), (3, 4, 2), (1, 2, 1), (1, 1, 1)Mipmap sizes generated by me:(26, 32, 16), (13, 16, 8), (7, 8, 4), (4, 4, 2), (2, 2, 1), (1, 1, 1)Notice how i have to round up in some cases. That's because of the original data.
Florian
The original data set is: 406,512,256;203,256,128;101,128,64;50,64,32;25,32,16;12,16,8;6,8,4;3,4,2;1,2,1; 1,1,1These are correct divide and floor sizes. But dividing by the blocksize results in some random rounding :/
Florian
A: 

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).

Bahbar
i just (re-)read the specification of ARB_texture_non_power_of_two. It states: "Note that this extension is compatible with supporting other [rounding] rules because it merely relaxes the error and completeness conditions for mipmaps."Based on that i'd say that rounding to any side should be possible.
Florian
@Florian, what you read just says that the extension has been written specifically to not prevent further extensions. But the full page before it explains why _floor_ was chosen (read the very first paragraph of that Issue). The specification part (not the issues list) only lists floor as a formula.
Bahbar
ok ... than i have to redo some of the stuff ... *sigh*
Florian