Jump to content
  • Advertisement
Sign in to follow this  
jdub

Why can't I lock this texture?

This topic is 2601 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,
size.Width,
size.Height,
1,
Usage.Dynamic,
Format.A8R8G8B8,
Pool.Default
);



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,
this.size.Height,
z );
data.Data.Write(buffer, 0, buffer.Length);
z++;
}

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!