Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Simple convolution question

  1. #1
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74

    Unhappy Simple convolution question

    Now, I stuck on another point of convolution.

    I have written the following code:

    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
    Code :
    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!

  2. #2
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Why nobody answers? Is this a hard question? Impossible!


    Best Regards,


    newbiecow

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,209
    Quote Originally Posted by newbiecow View Post
    Code cpp:
    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!
    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:

    * Chapter 7 :Imaging with OpenGL

    Nowadays, consider using your own shader to do this.

  4. #4
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Quote Originally Posted by Dark Photon View Post
    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:

    * Chapter 7 :Imaging with OpenGL

    Nowadays, consider using your own shader to do this.


    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

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,209
    Dunno. Hopefully someone else will chime in if they've done something like this.

  6. #6
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Quote Originally Posted by Dark Photon View Post
    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

  7. #7
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,209
    Go for it. This is a pretty old API, but can't hurt to ask.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •