How to flip vertical the output from Opengl application.

Sumit

New member
Can we flip the output image data from OpenGL application using NDI SDK or do we have to do it in the application and than send it.
 
Hello Sumit,

I ran into the exact same problem because the convention for OpenGL is: Textures are bottom up in memory.
But I was able to work around this issue by specifying a negative line_stride_in_bytes:

// Set the new data pointer and calculate line stride
// Note that the NDI SDK is expecting a top-down image wherea OpenGL is
// giving a bottom up image so we need to point the data pointer to the
// last line of the image and program a negative line stride.
int pixelSizeInBytes = pixelSizeInBytesFromNDIVideoType(m_ndiVideoFrame.FourCC);
int lineStrideInBytes = m_ndiVideoFrame.xres*pixelSizeInBytes;
m_ndiVideoFrame.p_data = pBottomUpImage + (m_ndiVideoFrame.yres-1)*lineStrideInBytes;
m_ndiVideoFrame.line_stride_in_bytes = -1 * lineStrideInBytes;

It works fine with NDIlib_FourCC_type_BGRX format but it crashes in the libndi.dylib (NDI version 5.0.3) with NDIlib_FourCC_type_UYVY format.
So I will restrict our NDI sender to RGB formats for now then.
Unless there is another way of selecting the image topness in the NDI SDK that I missed ?
In any case thank you NewTek ! This is a pretty neat SDK !

Bernie
 
Top Bottom