游戏开发论坛

 找回密码
 立即注册
搜索
查看: 3083|回复: 4

创建Lockable Surface/Texture总是失败..是参数的问题么?

[复制链接]

6

主题

390

帖子

400

积分

中级会员

Rank: 3Rank: 3

积分
400
发表于 2005-9-4 12:52:00 | 显示全部楼层 |阅读模式
我要创建一个可以LockRect以获取内容的Surface(实际上是DepthStencilSurface)。一开始我将CreateDevice的参数D3DPRESENT_PARAMETERS中的AutoDepthStencilFormat设为D3DFMT_D16_LOCKABLE,结果创建设备失败。

然后我尝试使用设置RenderTarget的方法,但是在CreateTexture时指定Usage为D3DFMT_D16_LOCKABLE就会创建失败。输出:
Direct3D9: (ERROR) :Invalid format specified for texture
Direct3D9: (ERROR) :Failure trying to create a texture
D3D9 Helper: IDirect3DDevice9::CreateTexture failed: D3DERR_INVALIDCALL

如果不指定D3DFMT_D16_LOCAKBLED的话就会在pTexture->LockRect时失败。输出:
Direct3D9: (ERROR) ock is not supported for textures allocated with POOL_DEFAULT unless they are marked D3DUSAGE_DYNAMIC.
Direct3D9: (ERROR) :Lock is not supported for depth formats other than D3DFMT_D16_LOCKABLE or D3DFMT_D32F_LOCKABLE
D3D9 Helper: IDirect3DTexture9::LockRect failed: D3DERR_INVALIDCALL


机器配置:nVIDIA FX5600,驱动版本 71.89,DirectX SDK 2004 Summer


各位有什么建议?

36

主题

1047

帖子

1147

积分

金牌会员

Rank: 6Rank: 6

积分
1147
发表于 2005-9-5 09:34:00 | 显示全部楼层

Re:创建Lockable Surface/Texture总是失败..是参数的问题么?

D3D 说得很明白了,照着提示做就是了。

6

主题

390

帖子

400

积分

中级会员

Rank: 3Rank: 3

积分
400
 楼主| 发表于 2005-9-5 18:40:00 | 显示全部楼层

Re:创建Lockable Surface/Texture总是失败..是参数的问题么?

我就是按照指示做的, 有错误的地方还请示教

7

主题

61

帖子

61

积分

注册会员

Rank: 2

积分
61
发表于 2005-9-5 18:54:00 | 显示全部楼层

Re:创建Lockable Surface/Texture总是失败..是参数的问题么?

Direct3D9: (ERROR) ock is not supported for textures allocated with POOL_DEFAULT unless they are marked D3DUSAGE_DYNAMIC.
Direct3D9: (ERROR) :Lock is not supported for depth formats other than D3DFMT_D16_LOCKABLE or D3DFMT_D32F_LOCKABLE
看英文都说明白了啊

6

主题

390

帖子

400

积分

中级会员

Rank: 3Rank: 3

积分
400
 楼主| 发表于 2005-9-6 18:50:00 | 显示全部楼层

Re:创建Lockable Surface/Texture总是失败..是参数的问题么?

我当然知道出错信息写了什么。但是按文档上的方法,我无法为我的机器找到一个合适的backbuffer以适应D3DFMT_D16_LOCKABLE的depth buffer
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-27 16:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表