I need some help making sense of this


I need some serious help.

This file should create mean average blur effect using a 3x3 kernel.

I am trying to change it to perform a gaussian blur with a 7x7 separable kernel.

The problem I am running into is that the code I posted makes very little sense to me. Most of it seems to be formalities revolving around opengl.

I am wondering if someone can tell me how this program works. I am a matlab noob in a C world and I am confused as all hell.

First off, that looks like someone is writing object-oriented code in C. And it calls tons and tons of other functions from all over Clutter (me having never seen most of it's source code doesn't help here and means I'm pretty much unable to describe what this does without using the words "that thing there what does something").

Basically it defines a blur GLSL shader around line 60. Then follows a whole load of code that seems reasonably generic, then around line 130 it fetches a specific texture from somewhere, gets it's width and height, then does something with it.
Then around line 162, it does something different which kind of looks like it's applying the blur effect.

Methods and functions related to our class/struct:
clutter_blur_effect_pre_paint() equal to calling pre_paint() inside our class (struct)
clutter_blur_effect_paint_target() equal to calling paint_target() inside our class (struct)
clutter_blur_effect_get_paint_volume() equal to calling get_paint_volume() inside our class (struct)
Initializer: clutter_blur_effect_class_init()
Constructor: clutter_blur_effect_new()
Destructor: clutter_blur_effect_dispose() equal to calling dispose() inside our class (struct)

I'm pretty sure that wasn't super useful, but it's all of the sense I can extract out of it right now. Also, C code doesn't usually look like this (as in, it's not usually object-oriented so if you look at something like the Quake II engine source code you'd find you can make a lot more sense of it - Quake II, by the way, also uses OpenGL and might have a blur shader somewhere in there so it might be worth a look).

Thanks for the reply.

I think the GLSL shader is coming from this file here. However I am not sure.

After doing some googling, I found that someone has already created the gaussian blur filter that I had in mind, and it also uses GLSL.

I just need to find a way to marry this code into clutter so that gnome shell can finally have some decent blur effects.