CreateTexture参数 [英] CreateTexture parameters

查看:219
本文介绍了CreateTexture参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用哪些参数来创建可以锁定和拉伸的纹理?

我用

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;
}


有人知道吗,我如何将LockRect应用于渲染目标纹理"中的数据?


Does somebody know, how can i apply LockRect to data in Render Target Texture?

推荐答案

必须创建动态结构才能锁定.
Dynamic tecture must be created to lock.


这篇关于CreateTexture参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆