Laurent Ach (ach++at++syseca.fr)
Mon, 6 Jul 1998 14:20:54 -0600
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
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:40 PDT