PDA

View Full Version : Editing Screen Buffer



EraZer
03-07-2004, 11:00 AM
How can I change the screen buffer (color buffer)? I want to add something (it doesn't matter what) to rasterized image. In other words, I want to work on rendered image/modify memory.

Are they any functions in OpenGL (or glu, glut) supporting post-render screen manupilation?

mikael_aronsson
03-07-2004, 11:06 PM
Hi !

You can use glReadPixels/glDrawPixels to read and write from/to the framebuffer.

But remeber that none of these function are very fast as they have to transfer data from the GPU's memory to RAM and the other way around.

Mikael

EraZer
03-08-2004, 03:29 PM
Thanks.

I was thinking about that, but, as you wrote, these functions are not the fastest. So I am looking for a method of direct-writing/reading to/form screen buffer. If anyone has any idea, how to do this, I would be grateful for help.

roffe
03-08-2004, 04:07 PM
Originally posted by EraZer:
So I am looking for a method of direct-writing/reading to/form screen buffer. If anyone has any idea, how to do this, I would be grateful for help.

OpenGL doesn't provide a way of directly editing the frame buffer. However, depending on how you want to edit your frame buffer you can just copy it to a texture and use it(glCopyTexImageXX). With fragment programs you can then edit every texel(fragment) individually in any way you want. Fixed function/Reg combinders offers a more limited form of functionality, but still provides basic add/sub/mul/scale features.