OpenGL makes slower ?

I have written one 2d filtering program. It uses 5.7 ms to filter 1366x768 image with a 5x7 2d filter. (Is that a good performance or can I optimize it more ?) Then I put this code segment into OpenGL’s display function to be able to use it real-time with a video but the time it consumes goes up to 19 ms. I measured the time used by the kernel function only. Does using OpenGL make such a difference ?

(I did change the “boxFilter” example to put my code into OpenGL and make some additional changes to show a color image)

I’ve seen the same behaviour here. The slowing down is probably because OpenGL only performs the display loop every refresh of the monitor (apparently yours is 50 Hz). Commenting out the glutSwapBuffers(); command will then increase your speed, but it wont refresh your display anymore.

You can make OpenGL swap the buffer faster than the display refresh by disabling the “sync to vblank” in the driver control panel (win and linux). Then, however you might see some tearing artifacts on fast moving objects as the display can show a partially updated buffer.

Peter