• Advertisement
Sign in to follow this  

Question about Direct3DTexture8.LockRect

This topic is 4794 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Direct3DTexture8.LockRect() requires a D3DLOCKED_RECT structure as one of its parameters, and part of this structure is the surface pitch. (The other part is a pointer to the surface bits, which I'm assuming is what you access when you want to read/write data.) My question is, how do I know what to pass as the pitch? Pitch isn't always the same as width, and the surface description (retrieved using GetLevelDesc) doesn't return pitch. Another question: is the managed pool the best place to store a texture I plan to alter 30 or so times a second? I'm talking writes, not reads.

Share this post


Link to post
Share on other sites
Advertisement
Actually, LockRect() will fill that structure, you just need to provide it a valid pointer to a D3DLOCKED_RECT.

For a dynamic texture, I think you should use the D3DUSAGE_DYNAMIC usage flag, and it is not compatible with the managed pool, D3DPOOL_DEFAULT should be used instead. You need to check the device caps to see if dynamic texture are supported (D3DCAPSx::Caps2 -> D3DCAPS2_DYNAMICTEXTURES).

Share this post


Link to post
Share on other sites
Of course I should have known this. Thanks Aldenar.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement