PDA

View Full Version : reading and writing to the video frame buffer



dduran
03-10-2006, 11:58 AM
I'm on Windows XP using Visual C++ 6.0.

I need to capture the image in the video frame buffer, modify it by putting a small graphic along the bottom sixteenth of the image, and write it back to the video frame buffer for display in somewhat real time.

Any leads to working code or function calls in openML, openGL, or other would be most appreciated. A solution comparable to the openGL DMbuffer extensions for XFree86 and IRIX operating systems would also work perfectly.
Thank you -

V-man
03-13-2006, 01:51 PM
If you are using OpenGL,

glClear(...)
//Render you stuff

//Read from back buffer
glReadPixels(...)

//Modify pixels

glLoadIdentity();
glRasterPos2i(0, 0);
glDrawPixels(...);

SwapBuffers();

For best performance, use the same format as the backbuffer.

ZbuffeR
03-14-2006, 12:00 AM
Maybe PBO can help, performance wise :
http://oss.sgi.com/projects/ogl-sample/registry/ARB/pixel_buffer_object.txt

EDIT: Do you have a real reason to bring back the frame buffer (saving to disk, whatever) ?
Else, why not adding your small graphics directly at the right place using opengl ? That would be much MUCH faster.

yooyo
03-14-2006, 03:28 AM
You have two frame buffers:
- video FB
- OpenGL FB

If I understand corectly, you want to grab frame from video FB add some graphics and write back to video FB. For such action, you don't need OpenGL and you must do all this things on CPU. Even more.. just grab 1/16 part of screen and modify it's content.

If you want to use OpenGL, you must grab frame, upload as OpenGL texture, render frame using OpenGL then render additional graphics, readback result from OpenGL and copy to video FB.

in short... video FB -> system memory -> OGL texture -> OGL FB -> render additional graphics -> system memory -> video FB

It will be much easier to use for example Quadro card with SDI output and pipeline will be:
video FB -> OpenGL texture -> OpenGL FB -> render additional graphics -> output to SDI. NVidia deliver additional OpenGL extenstion that expose interface to video frame buffer on Quadro card.
In this case you can apply any effect on incoming video stream using OpenGL and deliver proffesional quality output (key & fill).

yooyo

ZbuffeR
03-17-2006, 01:10 AM
dduran, the whole desktop framebuffer is not the OpenGL framebuffer.