Jump to content
  • Advertisement
Sign in to follow this  
Tape_Worm

[SlimDX] Texture.LockRect

This topic is 2782 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

It's been a very long time since I've touched this stuff, so bear with me if this is a dumb question.

I'm locking a region on a texture and attempting to dump an array of data into it. When I call the DataStream.Write(byte[], offset, size) method it appears to just dump the data in without respecting the region. The only thing that seems to be applied is the offset of the rect, the width/height don't seem to matter. Is this normal? How does the rectangular region specified in the LockRectangle parameter actually work when locking a texture?

I'm calling Texture.LockRectangle and passing in a rectangle of (100, 100)-(356, 356) to the rect parameter and passing no flags.

Here's a picture of what I'm seeing. The red area is the locked area (written one pixel at a time), the blue area is what happens when I just dump the array into the Write method:


[Edited by - Tape_Worm on December 5, 2010 2:23:47 PM]

Share this post


Link to post
Share on other sites
Advertisement
The Pitch of the returned structure must be taken into account, which says how many bytes are in each row. This may or may not be the same as the width of the rectangle, or even as the width of the whole texture (possible padding). You should be able to write a full row at a time however.

Share this post


Link to post
Share on other sites
Yeah, I kind of thought that might have something to do with it. I just wasn't sure how the LockRectangle handled locking a specific region. Thanks for the reply.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!