chronozphere
27-01-2007, 02:22 PM
Hi all 8)
I have a problem with loading a texture from memory.
I use this 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.fD3DDe vice,
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 doesn't seem to work :(
I have a problem with loading a texture from memory.
I use this 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.fD3DDe vice,
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 doesn't seem to work :(