realtime filter

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 its not working, and its slow like hell…
maybe someone did it before me? i will be very grateful for any kind of help.

and… i forgot: no shaders. i`ve got riva tnt2…

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.

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…?

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.