游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1274|回复: 1

关于LockRect得问题,请教高手们。

[复制链接]

1

主题

1

帖子

5

积分

新手上路

Rank: 1

积分
5
发表于 2008-8-5 17:16:00 | 显示全部楼层 |阅读模式
LPDIRECT3DTEXTURE9 pFilteredImage;
D3DLOCKED_RECT d3dlr;
pFilteredImage->LockRect(0,&d3dlr,NULL,0);
    for (y=0;y<surface_desc.Height;y++)
    {
        void* pSurfData=(BYTE*)d3dlr.pBits+d3dlr.Pitch*y;
        memcpy(pBuf,pSurfData,dwLineSize);
        pBuf+=dwLineSize;
    }
    pFilteredImage->UnlockRect(0);




d3dlr.Pitch的值怎么总是0啊

纹理使用D3DPOOL_DEFAULT创建的是不能Lock的~~~

Using Dynamic Textures
To find out if the driver supports dynamic textures, check the D3DCAPS2_DYNAMICTEXTURES flag of the D3DCAPS9 structure.

Keep the following things in mind when working with dynamic textures.

They cannot be managed. For example, their pool cannot be D3DPOOL_MANAGED.
Dynamic textures can be locked, even if they are created in D3DPOOL_DEFAULT.
D3DLOCK_DISCARD is a valid lock flag for dynamic textures.
It is a good idea to create only one dynamic texture per format and possibly per size. Dynamic mipmaps, cubes, and volumes are not recommended because of the additional overhead in locking every level. For mipmaps, D3DLOCK_DISCARD is allowed only on the top level. All levels are discarded by locking just the top level. This behavior is the same for volumes and cubes. For cubes, the top level and face 0 are locked.

14

主题

345

帖子

376

积分

中级会员

Rank: 3Rank: 3

积分
376
QQ
发表于 2008-8-5 22:13:00 | 显示全部楼层

Re:关于LockRect得问题,请教高手们。

usage你设成啥了
必须是dymamic的才行
如果pool是managed, 可以把usage设成0
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-21 19:16

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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