PDA

View Full Version : Basic Blur


mikedee
December 12th, 2006, 03:55 PM
This is another very old Compiz plugin which I found in my tmp dir.

I have patched it to work with current compiz, there is a problem with the GL code somewhere as it doesnt actually blur anything. Maybe I was just compiling it wrongly.

If anyone fancies having a go at making this work I would be grateful :) It is fairly simple to get to grips with so would be ideal for someone who wants to learn.

I cannot remember how this plugin originally worked so whoever fixes it will see :)

http://www.anykeysoftware.co.uk/compiz/plugins/basicblur.tar.gz

I originally added these lines to the addScreen function (as well as compiz.h) and it didnt crash so I assume it was OK. This is how compiz deals with these functions.

if (strstr (glExtensions, "GL_ARB_imaging"))
{
s->convFilter2D = (GLConvolutionFilter2DProc)
getProcAddress (s, "glConvolutionFilter2D");
s->convParameteri = (GLConvolutionParameteriProc)
getProcAddress (s, "glConvolutionParameteri");
}

julio
December 13th, 2006, 09:50 AM
Hello,
I did write this plugin ;)
It is loosely based on the neg plugin. When toggling "Blur screen" you should for example get something like this :
http://ghanima.alarue.net/albums/compiz/Screenshot_11.thumb.png (http://ghanima.alarue.net/gallery/compiz/Screenshot_11)

The version you used is a very old one that did not work well. I think I posted a more efficient version on the compiz-quinn forums a long time ago.
I should have it somewhere, I'll look for it when I get back home after work ;). I don't know if it is very usefull (but we can imagine other Convolution filters and this can become funny - the bad point is that this is not accelerated by the card :(), but you are right this was a very simple example to learn how plugins work.

mikedee
December 13th, 2006, 02:47 PM
Cool - thanks very much :)

I think we could speak with David about making it work for blurring under windows. It should be possible to get the compositor to help with under window effects.

julio
December 13th, 2006, 06:44 PM
My bad.
This is actually the last version I have...
What "does not work" ? What happens when you toggle the action key ? (something like Super+b I think) ?
It's been a while since the last time I compiled compiz, I may have time to test it tonight, but I'm not sure. I'll keep you updated.

On a side note, this is a blur that does not use shaders, but 1/ it's slow though usable (multiplicating two 1D filters should be faster without any noticeable difference) 2/ it works only before a glCopy or glDraw operation. That means that you will probably need to duplicate some texture if you want to blur under a window (because it has already been rendered)...

mikedee
December 13th, 2006, 06:51 PM
When I toggle the window key, it doesnt go blurry. There is a sligh flash but nothing else :(

julio
December 13th, 2006, 09:01 PM
Ok, I compiled it here, and I've got the same (no blur)
Note that I don't use the same graphic card : I have an ATI Mobility Radeon X1600 here, and I made my tests on an old gf4 back in the days...
Some debug is needed...

julio
December 13th, 2006, 09:34 PM
Ok I tracked down the problem.
glEnable(GL_CONVOLUTION_2D); generates a GL_INVALID_ENUM error.
Now I realize that glxinfo does not give me any GL_ARB_imaging extension, meaning that convolution filters are not available.
The question is: Why did it work on my gf4 + Xgl ?
And of course, how make it work (GL_ARB_imaging extension is here in the underlying Xorg server) ? Or am I (probably) missing something ?

mikedee
December 14th, 2006, 03:37 PM
Ok I tracked down the problem.
glEnable(GL_CONVOLUTION_2D); generates a GL_INVALID_ENUM error.
Now I realize that glxinfo does not give me any GL_ARB_imaging extension, meaning that convolution filters are not available.
The question is: Why did it work on my gf4 + Xgl ?
And of course, how make it work (GL_ARB_imaging extension is here in the underlying Xorg server) ? Or am I (probably) missing something ?

I do not know where this extension comes from - I use nVidia beta drivers and xorg 7.1 and I have it listed.

There were some patches to compiz-quinn so that this plugin could work (I think?), there are some setup functions for these gl functions although I do not claim to know why they are needed.

If you are really stuck, a post on the mailing list will probably sort things out :)

julio
December 14th, 2006, 08:19 PM
I should always verify before saying idiotic thing :)
I don't have any GL_ARB_imaging on my radeon... I did not think this was this rare... This extension is present on my gf4 though. I don't see any other way to make a real blur not too cpu demanding :(
Could you check if you have an error too when you call glEnable(GL_CONVOLUTION_2D);
with :
GLenum rc = glGetError();
if(GL_INVALID_ENUM == rc)
printf("Invalid Enum\n");
Before and after the call ?

mikedee
December 14th, 2006, 08:37 PM
There is nothing output with that extra code.

When I compile it I get these warnings, I am not sure if the makefile needs to be changed or if each of these needs to be loaded by compiz first (as for the other GL functions).

basicblur.c: In function `basicblurDrawWindowTexture':
basicblur.c:154: warning: implicit declaration of function `glConvolutionFilter2D'
basicblur.c:155: warning: implicit declaration of function `glConvolutionParameteri'