the usage of "glConvolutionFilter2D()"

I’m still interested in the way of using convolution matrix (such as “Laplace Sharpening”) in OpenGL,and I found the “glConvolutionFilter2D()” in RedBook,I think it could help me,but my code has incorrect influence upon the texture image,the texture image is white completely.Below is my convolution initialize code,please indicate my wrong,and plesae tell me whether the “glConvolutionFilter2D()” execute the matrix calculation in GPU?Thanks!

void InitConvolutionFilter()
{
GLfloat mat[3][3]={
{-0.125f,-0.125f,-0.125f},
{-0.125f, 1.0f,-0.125f},
{-0.125f,-0.125f,-0.125f}
};
PFNGLCONVOLUTIONFILTER2DPROC glConvolutionFilter2D=(PFNGLCONVOLUTIONFILTER2DPROC)wglGetProcAddress(“glConvolutionFilter2D”);
glConvolutionFilter2D(GL_CONVOLUTION_2D,GL_LUMINANCE,3,3,GL_LUMINANCE,GL_FLOAT,mat);
ASSERT(glGetError()==GL_NO_ERROR);
glEnable(GL_CONVOLUTION_2D);
}

Call it filter kernel calculation from now on instead of matrix calculation. It’s less confusing.

I’d say the code looks OK. You may want to try unsigned values like a blur kernel to see if there’s an implementation bug with signed floats. You should also try a simple drawpixels as a test too.

I don’t know if this would actually be implemented in the GPU, I doubt any PC chip makers bother making this stuff fast, if they even support it well.

Using multitexture is guaranteed to be hardware accelerated but takes a bit more effort to set up the taps & program the shaders. Ideally a vendor would wrap all this inside the convolution capability in the driver, but they have other priorities.

So, how about trying the multitextrue fragment program, or just plain old multitexture and texture matrix, you probably need to do multipass too since texture taps are limited to texture taps in a single pass (or coordinate interpolators if you don’t use a fragment program).

Originally posted by dorbie:
I don’t know if this would actually be implemented in the GPU, I doubt any PC chip makers bother making this stuff fast, if they even support it well.

OT ahead…

From what I’ve heard is that most of the imaging subset is not implemented in hw on consumer cards. But what about the Quadro line of cards? FireGL/Wildcats?? Anyone here playing around with these?

I use a Quadro4 on work and unfortunately, they do not support the imaging subset, too. It’s a pity, you could do a lot of nice effects with it.

But to come back to question, you should try to specify what should happen at the border with:
glConvolutionParameteri(GL_CONVOLUTION_2D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER);
Before I’ve used this, I had a white texture, too. In my case, it worked.

[This message has been edited by mako (edited 07-11-2003).]