void display(void) { GLubyte values[6]; glClear(GL_COLOR_BUFFER_BIT); glRasterPos2i(1, 1); glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels); glFlush(); glGetMinmax(GL_MINMAX, GL_TRUE, GL_RGB, GL_UNSIGNED_BYTE, values); printf(" Red : min = %d max = %d\n", values[0], values[3]); printf(" Green : min = %d max = %d\n", values[1], values[4]); printf(" Blue : min = %d max = %d\n", values[2], values[5]); }
static int GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; 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); reset = *(GLboolean *) (pc + 13); compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); glGetMinmax(target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; }
void Sample_8_9::draw() { GLubyte values[6]; OGLError err; OGLInspector inspector; if (m_prevSink != m_sink) { m_bImagSprt = inspector.ImagingSupported(); if (m_bImagSprt) { glMinmax(GL_MINMAX, GL_RGB, m_sink); if (err.checkError()) { glEnable(GL_MINMAX); glResetMinmax(GL_MINMAX); } else m_bImagSprt = false; } else { m_prevSink = m_sink; printf ("GL_ARB_imaging is not supported\n"); } } glRasterPos2i(5, 5); glDrawPixels( m_image.sizeX(), m_image.sizeY(), GL_RGB, GL_UNSIGNED_BYTE, m_image.data() ); if (m_prevSink != m_sink) { m_prevSink = m_sink; glGetMinmax(GL_MINMAX,GL_TRUE,GL_RGB,GL_UNSIGNED_BYTE,values); printf("====== MIN-MAX ======\n"); printf("Red : min = %d max = %d\n",values[0],values[3]); printf("Green: min = %d max = %d\n",values[1],values[4]); printf("Blue : min = %d max = %d\n",values[3],values[5]); } }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBImaging_nglGetMinmaxBO(JNIEnv *env, jclass clazz, jint target, jboolean reset, jint format, jint types, jlong values_buffer_offset, jlong function_pointer) { GLvoid *values_address = (GLvoid *)(intptr_t)offsetToPointer(values_buffer_offset); glGetMinmaxPROC glGetMinmax = (glGetMinmaxPROC)((intptr_t)function_pointer); glGetMinmax(target, reset, format, types, values_address); }