creating directx texture from raw image data
-
My goal: - display a texture that i can modify in real time (windowing the histogram) My steps: 1) create an array that will hold my raw information with fast access so i can modify windowing, the array is declared by setting RGB values 8 bit per pixel
// declaring array that will hold raw image array<Byte> dataArray = gcnew array<Byte>(Length);
2) modify the values of the images and set it to textureIO::MemoryStream ^fs = gcnew IO::MemoryStream(this->dataArray); fs->Seek(0,IO::SeekOrigin::Begin); try { mTexture = TextureLoader::FromStream(this->device, fs, (int)fs->Length, 768, 640, 0, Usage::None, Format::R8G8B8, Pool::Default, Filter::None, Filter::None, 0); } catch (Direct3D::InvalidDataException ^e) { te=e->ToString(); } fs->Close();
3) display a sprite with texture in itmSprite->Begin(SpriteFlags::None); mSprite->Draw(this->mTexture, Rectangle(posx*3,posy*3, 5000,5000), Vector3(0.0F, 0.0F, 0.0F), Vector3(0.0F, 0.0F, 0.0F), Color::White); mSprite->End();
the problem is that in this step it die on execution :( An unhandled exception of type 'Microsoft.DirectX.Direct3D.Direct3DXException' occurred in Microsoft.DirectX.Direct3DX.dll Additional information: Error in the application. Someone can help me point out the problem? thank in advance