Hi,
I ve been sitting here for around 5 hours now trying to figure why my second-last mipmap level always shows incorrect information (as debugged using gdebugger).
The problem is very specific.
What i do is uploading my image data to all mipmap texture levels with the glTexImage2D command, for example like this:
glTexImage2D(textureTarget, level, GL_RED, newSize, newSize, 0, GL_RED, GL_UNSIGNED_BYTE, newMipMap);
newMipMap points to my generated texture data : unsigned char[newSize*newSize]
It works fine for all texture levels from 1 to the last one, except for the SECOND LAST one, so the one that has 2x2 pixels dimension. This appears independently of the size of the original texture level, it is just always this specific texture level that has this problem.
What happens is that the data from newMipMap isn’t taken, however it takes the values outside the array, like the next 2 values in memory (could be something random) So effectively that means that the lower 2 pixels are correct, the upper two are incorrect.
Again this only happens for the 2x2 mipmap, and i use power of two textures, the 1x1 mipmap is correct and all others are correct as well. I tried to initialize the texture with no data, then call the glTexSubImage2D command and got the same result.
I also updated my drivers to the latest nvidia beta drivers, assuming it is a driver bug, that also didnt help… I found no hints toward that anyone had this issue before me, so i am not sure about that at all.
Very interestingly, the data generated by glGenerateMipmaps() does NOT suffer this problem. so i doubt it is a problem related to gdebugger reading wrong values.
Also i tried to initialize my image data with a gradient from 1 corner to opposite corner, and also tried it with a fixed value. In both cases the mipmap level 2x2 suffers the issue again, while all other texture levels are correct.
I m pretty much done with my ideas here.