• Advertisement
Sign in to follow this  

Why can't I lock this texture?

This topic is 2511 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
Wow.... I can't believe I forgot about that X/ thanks haha

Share this post


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

  • Advertisement