JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBImaging_nglGetSeparableFilterBO(JNIEnv *env, jclass clazz, jint target, jint format, jint type, jlong row_buffer_offset, jlong column_buffer_offset, jlong span_buffer_offset, jlong function_pointer) { GLvoid *row_address = (GLvoid *)(intptr_t)offsetToPointer(row_buffer_offset); GLvoid *column_address = (GLvoid *)(intptr_t)offsetToPointer(column_buffer_offset); GLvoid *span_address = (GLvoid *)(intptr_t)offsetToPointer(span_buffer_offset); glGetSeparableFilterPROC glGetSeparableFilter = (glGetSeparableFilterPROC)((intptr_t)function_pointer); glGetSeparableFilter(target, format, type, row_address, column_address, span_address); }
static int GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize, compsize2; 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); /* target must be SEPARABLE_2D, however I guess we can let the GL barf on this one.... */ glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); 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, 1, 1); compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); if ((compsize = safe_pad(compsize)) < 0) return BadLength; if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1); __glXClearErrorOccured(); glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLenum *) (pc + 8), answer, answer + compsize, NULL); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize + compsize2); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); ((xGLXGetSeparableFilterReply *) &reply)->width = width; ((xGLXGetSeparableFilterReply *) &reply)->height = height; __GLX_SEND_VOID_ARRAY(compsize + compsize2); } return Success; }