What parameters should i use to create texture, that can be locked and stretched?
I use
CComPtr<IDirect3DTexture9> local_source_texture;
local_handle_result = direct_3D_device->CreateTexture(
cxImage,
cyImage,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT,
&local_source_texture,
NULL);
if(local_handle_result!=D3D_OK)
{
return local_handle_result;
}
if(local_source_texture==NULL)
{
return local_handle_result;
}
D3DLOCKED_RECT local_locked_rectangle;
local_handle_result = local_source_texture->LockRect(0,&local_locked_rectangle,NULL,0);
if (local_handle_result!=D3D_OK)
{
return local_handle_result;
}
const int local_value_1 = cyImage-1;
DWORD* local_source_memory = (DWORD*)prgb+local_value_1*cxImage;
DWORD* local_destination_memory = (DWORD*)local_locked_rectangle.pBits;
load_media_sample_to_surface(local_destination_memory,local_source_memory,local_locked_rectangle.Pitch,cxImage,cyImage);
local_handle_result = local_source_texture->UnlockRect(0);
if (local_handle_result!=D3D_OK)
{
return local_handle_result;
}
and
CComPtr<IDirect3DSurface9> local_source_texture_surface;
CComPtr<IDirect3DSurface9> local_source_image_final_surface;
if((local_handle_result=local_source_texture->GetSurfaceLevel(0,&local_source_texture_surface))!=D3D_OK)
{
return local_handle_result;
}
if((local_handle_result=local_source_image_final->GetSurfaceLevel(0,&local_source_image_final_surface))!=D3D_OK)
{
return local_handle_result;
}
if((local_handle_result=direct_3D_device->StretchRect(local_source_texture_surface, &srcRect_stretch, local_source_image_final_surface, &local_source_rectangle_stretch, D3DTEXF_LINEAR))!=D3D_OK)
{
return local_handle_result;
}
Does somebody know, how can i apply LockRect to data in Render Target Texture?