When i writing into texture into mipmap level 0 only, i getting updating of all other levels. This bug repeats only on OpenGL driver.
To repeat bug open source of 02.Quake3Map example; found line "int lastFPS = -1;" and insert next code just after it:
Code: Select all
video::ITexture* t = mesh->getMesh(0)->getMeshBuffer(0)->getMaterial().getTexture(0);
video::SColor c = video::SColor(0xFFFF0000);
int p = t->getPitch();
video::ECOLOR_FORMAT f = t->getColorFormat();
int z = video::IImage::getBitsPerPixelFromFormat(f) / 8;
int m = 0; // can be from 0 to 8 (for texture with size 256x256)
void* b = t->lock(false, m);
if (b)
{
for (int x = 0; x < (256 >> m); x++)
for (int y = 0; y < (256 >> m); y++)
c.getData((unsigned char*)b + y * (p / (1 << m)) + x * z, f);
t->unlock();
}
Change m to set which mipmap level to use for writing.
The result is better visible when you compile and run the code.
Next image shows the result in comparison between OpenGL (left) and Direct3D9 (right):
P.S.: tested with Irrlicht trunk rev. 3311 on GeForce 9600M GT / WinVista 32bit.