You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for(int s=1; s<width || s<height; s <<= 1, ++numMipmapLevels) {}
Suppose width = height = 100 here.
The for loop will be executed 7 times for s = 1 -> 2 -> 4 -> 8 -> 16 -> 32 -> 64.
Therefore, the computed numMipmapLevels is 8.
This value will be handed over to glTexStorage3D() here:
GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_ARRAY, GL_PROXY_TEXTURE_2D_ARRAY, GL_TEXURE_CUBE_MAP_ARRAY, or GL_PROXY_TEXTURE_CUBE_MAP_ARRAY and levels is greater than ⌊log2(max(width, height))⌋+1.
Since width = height = 100, log2(max(width, height))=6.xxx and ⌊log2(max(width, height))⌋+1=7 which is smaller than computed numMipmapLevels.
This results into GL_INVALID_OPERATION error.
I am not familiar with mimap concept, so I cannot say nothing about the calculation math.
However, at least, I can tell the computed value does not satisfy the OpenGL requirement here.
The text was updated successfully, but these errors were encountered:
In
osg::Texture::computeRequiredTextureDimensions()
, the number of mipmap levels is miscalculated with NPOT texture.OpenSceneGraph/src/osg/Texture.cpp
Lines 2077 to 2078 in f7d9053
Suppose
width = height = 100
here.The
for
loop will be executed 7 times fors = 1 -> 2 -> 4 -> 8 -> 16 -> 32 -> 64
.Therefore, the computed
numMipmapLevels
is 8.This value will be handed over to
glTexStorage3D()
here:OpenSceneGraph/src/osg/Texture2DArray.cpp
Line 358 in b8416a7
Now, the OpenGL specification says:
Since
width = height = 100
, log2(max(width, height))=6.xxx and ⌊log2(max(width, height))⌋+1=7 which is smaller than computednumMipmapLevels
.This results into GL_INVALID_OPERATION error.
I am not familiar with mimap concept, so I cannot say nothing about the calculation math.
However, at least, I can tell the computed value does not satisfy the OpenGL requirement here.
The text was updated successfully, but these errors were encountered: