PDA

View Full Version : realtime filter



02-28-2005, 10:06 PM
i try to write filter, which is doing some operations on correponding pixels of on my opengl window.

it`s looking like:

render_stuff
glReadPixels(..)
do_some_operations_on_readed_table
glWritePixels(..)
wglSwapBuffers(..)
jump to render_stuff

but it`s not working, and it`s slow like hell..
maybe someone did it before me? i will be very grateful for any kind of help.

02-28-2005, 10:14 PM
and.. i forgot: no shaders. i`ve got riva tnt2..

Overmind
03-01-2005, 01:13 AM
Getting data back from the GPU is always extremely slow.

If you can't use shaders, I'm afraid you are out of luck here. The normal procedure to do this kind of operation is:

- render scene to a texture
- render a fullscreen quad using the texture and a postprocessing shader

If the operation is simple enough, perhaps you could use combiners and/or a multipass algorithm with blending to perform it.

03-01-2005, 07:05 AM
but still i can:

- render scene to a texture
- do some operations on the texture, like xor or and
- render a fullscreen quad using the texture

and it still should be fast..?

Overmind
03-01-2005, 08:14 AM
You can't directly modify a texture, the only thing you can do is render it. But of course you can render a fullscreen quad with the texture and use for example glLogicOp(GL_XOR).

I don't know how fast glLogicOp is on a TNT2, but I think it's worth trying it out.