void My_Mouse(int button, int state, int x, int y) { if(state == GLUT_DOWN) { printf("Mouse %d is pressed at (%d, %d)\n", button, x, y); { downX = x; downY = y; mouse_button = button; glutPostOverlayRedisplay(); } } else if(state == GLUT_UP) { printf("Mouse %d is released at (%d, %d)\n", button, x, y); { //mouse scroll if (button == 3){ if (nRange > 1.0f) nRange -= 1.0f; } else if (button == 4){ if (nRange <= 100.0f)nRange += 1.0f; } glutPostOverlayRedisplay(); } } }
void mouse(int button, int state, int x, int y) { GLdouble objx, objy, objz; gluUnProject(x, height - y, 0.95, modelMatrix, projMatrix, viewport, &objx, &objy, &objz); overlaySphere.x = objx; overlaySphere.y = objy; overlaySphere.z = objz; overlaySphere.material = button; glutUseLayer(GLUT_OVERLAY); glutSetColor(opaque, 2 * matColor[button][0], /* Red. */ 2 * matColor[button][1], /* Green. */ 2 * matColor[button][2]); /* Blue. */ if (state == GLUT_UP) { glutHideOverlay(); if (spheres < MAX_SPHERES) { sphereInfo[spheres] = overlaySphere; sphereInfo[spheres].detail = 25; /* Fine tesselation. */ spheres++; } else { printf("oversphere: Out of spheres.\n"); } glutPostRedisplay(); } else { overlaySphere.detail = 10; /* Coarse tesselation. */ glutShowOverlay(); glutPostOverlayRedisplay(); } }
void motion(int x, int y) { GLdouble objx, objy, objz; gluUnProject(x, height - y, 0.95, modelMatrix, projMatrix, viewport, &objx, &objy, &objz); overlaySphere.x = objx; overlaySphere.y = objy; overlaySphere.z = objz; glutPostOverlayRedisplay(); }
static void display2(void) { static int been_here = 0; if (glutLayerGet(GLUT_NORMAL_DAMAGED) != 0) { printf("FAIL: normal damage not expected\n"); exit(1); } if (glutLayerGet(GLUT_OVERLAY_DAMAGED) != 0) { printf("FAIL: overlay damage not expected\n"); exit(1); } if (been_here) { glutPostOverlayRedisplay(); } else { glutOverlayDisplayFunc(display_overlay); glutDisplayFunc(display_normal); damage_expectation = 0; glutPostOverlayRedisplay(); glutPostRedisplay(); } }
void motion(int x, int y) { if (moving) { angle = angle + (x - begin); begin = x; newModel = 1; glutPostRedisplay(); } if (rubberbanding) { stretchx = x; stretchy = y; glutPostOverlayRedisplay(); } }
void controlLights(int value) { glutUseLayer(GLUT_NORMAL); switch (value) { case 1: lightZeroSwitch = !lightZeroSwitch; if (lightZeroSwitch) { glEnable(GL_LIGHT0); } else { glDisable(GL_LIGHT0); } break; case 2: lightOneSwitch = !lightOneSwitch; if (lightOneSwitch) { glEnable(GL_LIGHT1); } else { glDisable(GL_LIGHT1); } break; case 3: defaultProjection(); break; case 4: fancy = 1; break; case 5: fancy = 0; wasFancy = 1; break; case 6: if (!rubberbanding) help = 1; glutShowOverlay(); glutPostOverlayRedisplay(); break; } glutPostRedisplay(); }
void special(int c, int w, int h) { printf("special %d w=%d h=%d\n", c, w, h); if (on) { switch (c) { case GLUT_KEY_LEFT: x -= 0.1; break; case GLUT_KEY_RIGHT: x += 0.1; break; case GLUT_KEY_UP: y += 0.1; break; case GLUT_KEY_DOWN: y -= 0.1; break; } glutPostOverlayRedisplay(); } }
/* * Class: gruenewa_opengl_GLUT__ * Method: glutPostOverlayRedisplay * Signature: ()V */ JNIEXPORT void JNICALL Java_gruenewa_opengl_GLUT_00024_glutPostOverlayRedisplay (JNIEnv * jenv, jobject jobj) { glutPostOverlayRedisplay(); }