Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
What parameters should i use to create texture, that can be locked and stretched?

I use
C++
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
C++
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?
Posted
Updated 13-Dec-10 23:18pm
v3
Comments
[no name] 13-Dec-10 4:29am    
LockRect returns 0x8876086c

1 solution

Dynamic tecture must be created to lock.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900