PDA

View Full Version : Using glDrawPixels



Mukund
10-27-2010, 09:33 AM
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.

Anirban Talukdar
10-27-2010, 10:15 AM
The third argument glDrawPixels can be GL_RGB or GL_BGRA. Have you tried that?

Thanks & Regards
Anirban Talukdar

Mukund
10-27-2010, 01:51 PM
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! :)