I am using the old webcam component file to stream a webcam video feed onto a Texture2D object.
I need help with the code as it is old and visual studio 2010 and XNA 4 does not recognize some of the syntax.
In the method BufferCB, the two lines that modify color are outdated. It says the "The type or namespace name Color does not exist in the namespace Microsoft.XNA.Framwork.Graphics (are you missing an assembly reference?)".
Here is the function:
public int BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen)
{
byte[] bgrData = new byte[BufferLen];
Marshal.Copy(pBuffer, bgrData, 0, BufferLen);
Color[] colorData = new Color[BufferLen / 3];
for (int i = 0; i < colorData.Length; i++)
{
colorData[i] = new Microsoft.Xna.Framework.Graphics.Color(bgrData[3 * i + 2], bgrData[3 * i + 1], bgrData[3 * i]);
}
this.videoTexture.SetData<Microsoft.Xna.Framework.Graphics.Color>(colorData);
return 0;
}
The line in the for loop and the line of code right after the for loop have the Color problem.
Also, how do I instantiate this class in my game class?
Any help would be great. Thanks