Ejemplo n.º 1
0
Archivo: s_imaging.c Proyecto: aosm/X11
void
_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, 
				GLenum internalFormat, 
				GLint x, GLint y, GLsizei width)
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   GLchan rgba[MAX_CONVOLUTION_WIDTH][4];

   /* Select buffer to read from */
   _swrast_use_read_buffer(ctx);

   RENDER_START( swrast, ctx );

   /* read the data from framebuffer */
   _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y,
				(GLchan (*)[4]) rgba );
   
   RENDER_FINISH( swrast, ctx );

   /* Restore reading from draw buffer (the default) */
   _swrast_use_draw_buffer(ctx);

   /* store as convolution filter */
   glConvolutionFilter1D(target, internalFormat, width,
			 GL_RGBA, CHAN_TYPE, rgba);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBImaging_nglConvolutionFilter1DBO(JNIEnv *env, jclass clazz, jint target, jint internalformat, jint width, jint format, jint type, jlong image_buffer_offset, jlong function_pointer) {
    const GLvoid *image_address = (const GLvoid *)(intptr_t)offsetToPointer(image_buffer_offset);
    glConvolutionFilter1DPROC glConvolutionFilter1D = (glConvolutionFilter1DPROC)((intptr_t)function_pointer);
    glConvolutionFilter1D(target, internalformat, width, format, type, image_address);
}