Using glDrawPixels

Hello everyone.

im capturing video from a webcam using OpenCV and then im rendering each frame using OpenGL.

im using glDrawPixels() for that.

glDrawPixels(640, 480, GL_RGB, GL_UNSIGNED_BYTE, image_data);

But im having a small problem.
The frame i obtain using OpenCV has BGR format. But in glDrawPixels, i could not find that format. So, colors are not displayed properly.

Is there any way i can solve it? Can anyone please help?
Thanks.

The third argument glDrawPixels can be GL_RGB or GL_BGRA. Have you tried that?

Thanks & Regards
Anirban Talukdar

Thanks for the reply. Yes i did try it, but the compiler reported an undeclared identifier!

So, i looked up in the glut header file an found this: GL_BGR_EXT

Now it is working. Thanks a lot! :slight_smile: