hi, i'm writing a D3D game engine in Visual C++ 6.0
I've recently run into a problem with using lightmaps. not the algoritm part is what bothers me, but maybe(?) a API problem. i'm locking a dynamic texture in order to write to it, and then when i unlock it, the whole system crashes
lpDevice->CreateTexture(8, 8,0,D3DUSAGE_DYNAMIC | 3DUSAGE_AUTOGENMIPMAP,
for (int i=0; i<64; i++) *((DWORD*)(rect.pBits)+i) = 0xFF000000;
when UnlockRect() gets called, the system crashes for a few seconds and then trhows me into a 16 color desktop, from which there's nothing else to do but restart windows.
I've run the code step by step and none of the variables are NULL, they all work as they should, but when i get to the UnlockRect(0) statement, it crashes.
If I remove the D3DUSAGE_AUTOGENMIPMAP flag from the creation of the texture, it won't crash any more at the UnlockRect(0) statement, but will crash in exchange when i draw a primitive with this texture on Stage 0.
I really can't see what's going on.... Am I doing something wrong??? can anyone help me ???? i'm really frustrated with this one.