Please bear with me. I haven't done any C++ before. I've been experimenting with the NDI SDK and I'm trying to get the RGB values from an NDI source. I've been using this code to produce pixel data:
unsigned char *pixels = new unsigned char[video_frame.xres * video_frame.yres * 4];
ofxNDIutils::CopyImage((const unsigned char *)video_frame.p_data, pixels, video_frame.xres, video_frame.yres, (unsigned int)video_frame.line_stride_in_bytes, false, false);
and I'm attempting to get the values with this:
for (int y = 0; y < video_frame.yres; y++)
{
for (int x = 0; x < video_frame.xres; x++)
{
printf("r:%d g:%d b:%d a:%d", pixels[4 * x * y + 0],pixels[4 * x * y + 1],pixels[4 * x * y + 2],pixels[4 * x * y + 3]);
}
}
I'm getting values but when I use them to construct an image it doesn't look right. Any help would be appreciated.
It turns out I had my logic wrong. Here is my current solution: