Hi
I am trying to show webcam video in my XNA Project. I am using AForge Library and has successfully implemented the webcam video on my Windows Form Project.
In form i am showing the video in pictureBox, but in XNA i am unable to understand how to send video data to Texture2d.
Kindly check the code and guide me.
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here+ //WebCamVideo - Start VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo VideoCaptureDevice in VideoCaptureDevices) { DeviceName = VideoCaptureDevice.Name; } myfont = Content.Load<SpriteFont>("myfont"); FinalVideo = new VideoCaptureDevice(VideoCaptureDevices[0].MonikerString); FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame); FinalVideo.Start(); //WebCamVideo- End }
void FinalVideo_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
// throw new NotImplementedException();
}
Regards
Taha