GLSL shaders for images


Using a lib i loaded a bmp image as a texture and i rendered it in opengl. Is it possible to apply shaders on the texture to give a tooning effect?

If you mean toon-shading (cel-shading) … i believe this is normally applied to 3d-models rather than images.
However, if you know an image filter that does what you need you can most likely implement it as a shader somehow.

try decimating the color.
if the frag shader is currently “gl_FragColor=color;”

float scale = 8.0;
color = floor(color*scale);
color/= scale;
gl_FragColor = color;

Sobel filter which is also known as edge detection algorithm for 2d images.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.