How to apply image processing to OpenGL?

Sorry if the question is too general, but I mean it; in OpenGL, before performing a buffer swap to make the buffer visible on the screen, there must be some function calls to do some image processing. I mean, for example, blurring the screen, twisting parts of the screen, etc. Or doing some interesting β€œtouches,” such as flowering, etc.

What are the keywords and feature sets of OpenGL that I should look for if I want to do what I said above?

+4
source share
1 answer

Since you cannot, in general, read / write to the framebuffer in the same operation (except for simple mixing), you need to display the textures using FBO: s (FrameBufferObject), and then perform various processing on those, then make the final pass to the real one framebuffer.

This is the main part that you need to understand. Given this, you can sketch your "rendering tree" on paper, that is, which parts of the scene go to where and what are your effects, their input and output.

From there, you simply render one or more large squares covering the entire screen with a specific fragment shader that performs your effect using textures as input and one or more framebuffer objects as output.

+5
source

Source: https://habr.com/ru/post/1301185/


All Articles