JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBImaging_nglGetConvolutionFilterBO(JNIEnv *env, jclass clazz, jint target, jint format, jint type, jlong image_buffer_offset, jlong function_pointer) { GLvoid *image_address = (GLvoid *)(intptr_t)offsetToPointer(image_buffer_offset); glGetConvolutionFilterPROC glGetConvolutionFilter = (glGetConvolutionFilterPROC)((intptr_t)function_pointer); glGetConvolutionFilter(target, format, type, image_address); }
static int GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width = 0, height = 0; xGLXSingleReply reply = { 0, }; cx = __glXForceCurrent(cl, tag, &error); if (!cx) { return error; } __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); format = *(GLenum *) (pc + 4); type = *(GLenum *) (pc + 8); target = *(GLenum *) (pc + 0); swapBytes = *(GLboolean *) (pc + 12); glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); if (target == GL_CONVOLUTION_2D) { height = 1; } else { glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); } /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); ((xGLXGetConvolutionFilterReply *) &reply)->width = width; ((xGLXGetConvolutionFilterReply *) &reply)->height = height; __GLX_SEND_VOID_ARRAY(compsize); } return Success; }