Angus Dorbie (dorbie++at++sgi.com)
Mon, 06 Jul 1998 12:47:03 -0700
Cheers,Angus.
Laurent Ach wrote:
>
> On Jul 3, 5:28pm, Miguel Lozano Ibanyez wrote:
> > Subject: Convolutions in real time
> > Hi,
> >
> > I'm traying to convolve in real time with Performer 2.1. in a IR.
> > After some "panics" in my machine and a lot of 'invalid operation'
> > I'd like to know if somebody has done this before.
> >
> > Now I'm using the accumulation buffer to run convolutions and I
> > don't know if this is the best way (better than
> > glConvolutionFilter2DEXT?)
> >
> >-- End of excerpt from Miguel Lozano Ibanyez
>
> I have already filter an image from the framebuffer using
> glConvolutionFilter2DEXT on an IR and it worked OK. The filter function is
> called in a Performer 2.1 application, from the draw process.
> The source code looks like this:
>
> // read and filter an RGBA (xsize, ysize) image from framebuffer
>
> unsigned long *scrbuf = (unsigned long *) pfMalloc(xsize*ysize*sizeof(long),
> NULL);
> glEnable(GL_CONVOLUTION_2D_EXT);
> glReadBuffer(GL_FRONT) // or any buffer you like
>
> // find allowed dimensions for filter:
> int max_width, max_height;
> glGetConvolutionParameterivEXT(GL_CONVOLUTION_2D_EXT,
> GL_MAX_CONVOLUTION_WIDTH_EXT, &max_width);
> glGetConvolutionParameterivEXT(GL_CONVOLUTION_2D_EXT,
> GL_MAX_CONVOLUTION_HEIGHT_EXT, &max_height);
>
> // create the filter array
> float *filter = new float[max_width * max_height * 3];
> for (int i = 0; i < filter_width * filter_width; i++) {
> filter[i * 3] = <something>
> filter[i * 3 + 1] = <something>
> filter[i * 3 + 2] = <something>
> }
> // set filter RGB format and some parameters ...
> glConvolutionParameteriEXT(GL_CONVOLUTION_2D_EXT,
> GL_CONVOLUTION_BORDER_MODE_EXT, GL_REDUCE_EXT);
> glConvolutionFilter2DEXT(GL_CONVOLUTION_2D_EXT, GL_RGB,
> max_width, max_height, GL_RGB, GL_FLOAT, (GLvoid *) filter);
>
> // perform reading and filtering at point (xorg, yorg)
> glReadPixels((short)xorg, (short)yorg, (short)xsize, (short)ysize, GL_RGBA,
> GL_UNSIGNED_BYTE, scrbuf);
>
> // size of filtered pixel array:
> xsize -= max_width - 1;
> ysize -= max_height - 1;
>
> Espiero que eso te puede ayudar ...
>
> L.A.
>
> --
> --------------------------------------------------------------------
> Laurent Ach tel : 33 (0) 1 41 48 06 60
> SYSECA fax : 33 (0) 1 41 48 06 81
> ach++at++syseca.fr
> http://www.syseca.thomson-csf.com/english/cha1/SDA.HTM
> --------------------------------------------------------------------
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
-- "Only the mediocre are always at their best." -- Jean GiraudouxFor advanced 3D graphics Performer + OpenGL based examples and tutors: http://www.dorbie.com/ ======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:40 PDT