Hi all

I have a problem with loading a texture from memory.
I use this code:

Code:
    
Stream := TMemoryStream.Create;
    try
      fBitmap.SaveToStream(Stream);
      if fFormat = pf16bit then
        fmt := D3DFMT_R5G6B5
      else
        fmt := D3DFMT_A8R8G8B8;
      {create texture from memory}
      HR := D3DXCreateTextureFromFileInMemoryEx(Graphic.fD3DDevice,
Stream.Memory,Stream.Size,0,0,0,0,
fmt,D3DPOOL_DEFAULT,D3DX_FILTER_NONE,
D3DX_DEFAULT,fTransColor,nil,nil,fTexture);
      if Failed(HR) then
      begin
        //Report error....
      end;
    finally
      Stream.Free;
    end;
The function returns D3DERR_INVALIDCALL but i cant figure out why,

Can anyone help me??
thanx

P.S [pascal][/pascal] doesn't seem to work