Problem with XNA and Touchless

Sep 22, 2010 at 4:04 AM

Hello, dudes, im trying work with Touchless and XNA, but i got a "liitle problem" i think. When start the capture imagem with webcan in XNA little time after starting the capture the capture become slow until stop and not update the imagem, following the code:

 

 

private Texture2D TextureFromBitmap(System.Drawing.Bitmap bitmap)

{

 

Texture2D tex = new Texture2D(grcTela.GraphicsDevice, bitmap.Width, bitmap.Height, 1, TextureUsage.None, SurfaceFormat.Color);

 

BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, bitmap.PixelFormat);

 

int bufferSize = data.Height * data.Stride;

 

byte[] bytes = new byte[bufferSize];

 

Marshal.Copy(data.Scan0, bytes, 0, bytes.Length);

tex.SetData(bytes);

bitmap.UnlockBits(data);

 

return tex;

sameone could help? i pass the marker position to XNA

capturaImg.AdicionarMarker(ms.X, ms.Y);

}