Sign in to follow this  

DD Surface locking: a few questions

Recommended Posts

sanity    126
Sup, I am using the Surface.Lock and Unlock methods for particle/line drawing using managed DirectX and C#, and I was wondering if you guys could answer a few questions or point me in the direction of some rescources. So here goes: 1. Anyone know what the Rectangle in one of the overloaded Lock and Unlock methods of the surface class is used for? I first thought it might represent the screen position that the byte array represented, but it just seems to make my app crash. 2. I have read (and noticed) that locking can be slow when used on large surfaces. Does anyone have any suggestions on how to speed things up? 3. Finally is locking the way you guys draw particles and lines or is their something I have missed? Cheers, Toby.

Share this post

Link to post
Share on other sites
turnpast    1011
The rectangle is used to lock only a portion of the surface. Supposedly you can lock multiple rectangles (that do not intersect) on a surface and update (use/copy etc.) them at the same time perhaps from differnet threads. I imagine (though I could be completely wrong) that it is faster to lock only the region of the surface that you are interested in.

There are many differnet ways of drawing lines:
The Line class uses textured triangles to provide width and patterns. Line strips and lists can work for simple applications. And have this nice property of actaully being 3d. Like you implied drawing on a surface is another way to get lines. Guess it all really depends on your application.

Sorry, don't know much about particles.

hope this helps.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this