Results 1 to 7 of 7

Thread: Simple convolution question

  1. #1
    Member 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
    Member 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
    Join Date
    Oct 2004
    Posts
    4,654
    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
    Member 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
    Join Date
    Oct 2004
    Posts
    4,654
    Dunno. Hopefully someone else will chime in if they've done something like this.

  6. #6
    Member 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
    Join Date
    Oct 2004
    Posts
    4,654
    Go for it. This is a pretty old API, but can't hurt to ask.

Similar Threads

  1. simple question
    By technologist in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-04-2017, 11:57 AM
  2. Simple convolution question
    By newbiecow in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 12-27-2012, 11:35 AM
  3. Simple question about convolution on GL_RED
    By newbiecow in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-22-2012, 09:47 AM
  4. Simple example of texture/convolution?
    By jamesqf in forum OpenGL: GLSL
    Replies: 12
    Last Post: 12-18-2008, 01:01 AM
  5. A simple question
    By pantxua in forum OpenGL: GLSL
    Replies: 2
    Last Post: 05-29-2004, 04:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean