Simple convolution question

Now, I stuck on another point of convolution.

I have written the following code:


GLubyte convolutionTable3x3[3][3]=
{
	{1,1,1},
	{1,1,1},
	{1,1,1}
};

glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glConvolutionFilter2D(GL_CONVOLUTION_2D,GL_LUMINANCE,3,3,GL_LUMINANCE,GL_UNSIGNED_BYTE,convolutionTable3x3);
glEnable(GL_CONVOLUTION_2D);
glWindowPos2i(0,0);
glDrawPixels(512,512,GL_STENCIL_INDEX,GL_UNSIGNED_BYTE,pboImageStore);
glDisable(GL_CONVOLUTION_2D);

The buffer pboImageStore has some value set 0 and some 2.
The result seems that the stencil buffer has all been set to zero.

Even when I set


GLubyte convolutionTable3x3[3][3]=
{
	{0,0,0},
	{0,1,0},
	{0,0,0}
};

The result seems that the stencil buffer has all been set to zero.

How can this be so? I just want to do some convolution on my stencil buffer.
Thanks in advance!

Why nobody answers? Is this a hard question? Impossible!

Best Regards,

newbiecow

[QUOTE=newbiecow;1246068]

glConvolutionFilter2D(GL_CONVOLUTION_2D,GL_LUMINANCE,3,3,GL_LUMINANCE,GL_UNSIGNED_BYTE,convolutionTable3x3);
glEnable(GL_CONVOLUTION_2D);

Why nobody answers? Is this a hard question? Impossible![/QUOTE]

Consider one reason might be that nobody that’s read your post has ever used it. A few net searches reveal this was part of the OpenGL 1.2 “imaging subset”, which was always optional, and has had spotty cross-vendor support over the years. As a random sample, check out this Mesa3D thread: link

Try net-searching for tutorials using that function. For instance:

Nowadays, consider using your own shader to do this.

[QUOTE=Dark Photon;1246077]Consider one reason might be that nobody that’s read your post has ever used it. A few net searches reveal this was part of the OpenGL 1.2 “imaging subset”, which was always optional, and has had spotty cross-vendor support over the years. As a random sample, check out this Mesa3D thread: link

Try net-searching for tutorials using that function. For instance:

Nowadays, consider using your own shader to do this.[/QUOTE]

Thanks, Dark Photon.

This extension feature convolution, where in my code represented as “glConvolutionFilter2D”, is definitely supported by my graphics card, because I have correctly run another program with “glConvolutionFilter2D” and produced the desired effect. But where you did not notice is, here in this program, I wrote the result into the stencil buffer. Can you tell me if such feature is supported by modern graphics cards such as Nvidia or ATI, doing something of convolution and write the result into the stencil buffer. Or if I can write a shader to store the result in the stencil buffer for further rendering of the color buffer with mask operation of the former produced result in the stencil buffer.

Best Regards,

newbiecow

Dunno. Hopefully someone else will chime in if they’ve done something like this.

So do you think this question is already not a biginner’s one and should I post this question in the advanced opengl forum?

Best Regards,

newbiecow

Go for it. This is a pretty old API, but can’t hurt to ask.