Advertisement Jump to content
Sign in to follow this  

Why can't I lock this texture?

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

Every frame, I lock a texture, discarding its contents and generating a different texture. However, after the first frame of locking and generating the texture, when I go to lock it again, directX throws a fit. P.S. Code is in C#/SlimDX(dx wrapper) but should look very similar to how it looks in directX. What's wrong here?

Texture Creation:

this.frame = new Texture(game.DeviceManager.Device,

Texture Updating:

private void generateFrame()
byte[] buffer = new byte[size.Width * size.Height * 4];
DataRectangle data = this.frame.LockRectangle(0, LockFlags.Discard);
buffer = PerlinNoise3D.CreateSurfaceA8R8G8B8(this.size.Width,
z );
data.Data.Write(buffer, 0, buffer.Length);

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!