Example #1
0
static void
move_on(void)
{
  display_count++;
  if (display_count == 2) {
    damage_expectation = 1;
    glutIconifyWindow();
    glutTimerFunc(500, timer, 777);
  }
  if (display_count == 4) {
    printf("display_count == 4\n");
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateSubWindow(main_win, 10, 10, 150, 150);
    glClearColor(0.5, 0.5, 0.5, 0.0);
    glutDisplayFunc(render_sub);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_INDEX);
    glutEstablishOverlay();
    glutCopyColormap(main_win);
    glutSetColor((transP + 1) % 2, 0.0, 1.0, 1.0);
    glutRemoveOverlay();
    glutEstablishOverlay();
    glutCopyColormap(main_win);
    glutCopyColormap(main_win);
    glutSetColor((transP + 1) % 2, 1.0, 1.0, 1.0);
    glClearIndex(transP);
    glIndexf((transP + 1) % 2);
    glutSetWindow(main_win);
    glutRemoveOverlay();
    glutTimerFunc(500, time2, 888);
  }
}
Example #2
0
int
main(int argc, char **argv)
{
  glutInit(&argc, argv);

  glutInitDisplayMode(GLUT_RGB);
  main_w = glutCreateWindow("test9");
  glClearColor(0.0, 0.0, 0.0, 0.0);  /* black */
  glutDisplayFunc(display);
  glutInitDisplayMode(GLUT_INDEX);
  if (!glutGet(GLUT_DISPLAY_MODE_POSSIBLE)) {
    printf("UNRESOLVED: test9 (your OpenGL lacks color index support)\n");
    exit(0);
  }
  w1 = glutCreateSubWindow(main_w, 10, 10, 10, 10);
  glutSetColor(1, 1.0, 0.0, 0.0);  /* red */
  glutSetColor(2, 0.0, 1.0, 0.0);  /* green */
  glutSetColor(3, 0.0, 0.0, 1.0);  /* blue */
  glClearIndex(1);
  glutDisplayFunc(display);
  w2 = glutCreateSubWindow(main_w, 30, 30, 10, 10);
  glutCopyColormap(w1);
  glClearIndex(2);
  glutDisplayFunc(display);
  w3 = glutCreateSubWindow(main_w, 50, 50, 10, 10);
  glutCopyColormap(w1);
  glClearIndex(3);
  glutDisplayFunc(display);
  w4 = glutCreateSubWindow(main_w, 70, 70, 10, 10);
  glutCopyColormap(w1);
  glutSetColor(3, 1.0, 1.0, 1.0);  /* white */
  glClearIndex(3);
  glutDisplayFunc(display);
  glutTimerFunc(750, time1, 0);
  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
Example #3
0
/* ARGSUSED1 */
void
key2(unsigned char c, int w, int h)
{
  int transP;

  printf("c=%d\n", c);
  switch (c) {
  case 'g':
    glutReshapeWindow(
      glutGet(GLUT_WINDOW_WIDTH) + 2, glutGet(GLUT_WINDOW_HEIGHT) + 2);
    break;
  case 's':
    glutReshapeWindow(
      glutGet(GLUT_WINDOW_WIDTH) - 2, glutGet(GLUT_WINDOW_HEIGHT) - 2);
    break;
  case 'u':
    glutPopWindow();
    break;
  case 'd':
    glutPushWindow();
    break;
  case 'e':
    glutEstablishOverlay();
    transP = glutLayerGet(GLUT_TRANSPARENT_INDEX);
    glClearIndex(transP);
    glutSetColor((transP + 1) % 2, 0.0, 0.25, 0.0);
    glIndexi((transP + 1) % 2);
    break;
  case 'c':
    if (glutLayerGet(GLUT_HAS_OVERLAY)) {
      glutUseLayer(GLUT_OVERLAY);
      glutCopyColormap(main_w);
    }
    break;
  case 'r':
    glutRemoveOverlay();
    break;
  case ' ':
    printf("overlay possible: %d\n", glutLayerGet(GLUT_OVERLAY_POSSIBLE));
    printf("layer in  use: %d\n", glutLayerGet(GLUT_LAYER_IN_USE));
    printf("has overlay: %d\n", glutLayerGet(GLUT_HAS_OVERLAY));
    printf("transparent index: %d\n", glutLayerGet(GLUT_TRANSPARENT_INDEX));
    break;
  }
}
Example #4
0
static int CopyColormap(lua_State *L) 
    {
    int window = luaL_checkinteger(L, 1);
    glutCopyColormap(window);
    return 0;
    }
Example #5
0
int
main(int argc, char **argv)
{
  int win1, win2, size;
  GLint isIndex;

  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_INDEX);
  if (!glutGet(GLUT_DISPLAY_MODE_POSSIBLE)) {
    printf("UNRESOLVED: test5 (your OpenGL lacks color index support)\n");
    exit(0);
  }
  glutInitWindowPosition(45, 45);
  win1 = glutCreateWindow("CI test 1");
  glGetIntegerv(GL_INDEX_MODE, &isIndex);
  if (isIndex == 0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  size = glutGet(GLUT_WINDOW_COLORMAP_SIZE);
  if (size <= 1 || size > (1 << glutGet(GLUT_WINDOW_BUFFER_SIZE))) {
    printf("FAIL: test5\n");
    exit(1);
  }
  glutSetColor(2, 1.0, 3.4, 0.5);
  comp = glutGetColor(2, GLUT_RED);
  if (comp != 1.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  comp = glutGetColor(2, GLUT_GREEN);
  if (comp != 1.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  comp = glutGetColor(2, GLUT_BLUE);
  if (comp != 0.5) {
    printf("FAIL: test5\n");
    exit(1);
  }
  glutInitWindowPosition(450, 450);
  win2 = glutCreateWindow("CI test 2");
  glutCopyColormap(win1);
  if (glutGetColor(2, GLUT_RED) != 1.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_GREEN) != 1.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_BLUE) != 0.5) {
    printf("FAIL: test5\n");
    exit(1);
  }
  glutSetColor(2, -1.0, 0.25, 0.75);
  glutSetWindow(win1);
  if (win1 != glutGetWindow()) {
    printf("FAIL: test5\n");
    exit(1);
  }
  glutDisplayFunc(display);
  if (glutGetColor(2, GLUT_RED) != 1.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_GREEN) != 1.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_BLUE) != 0.5) {
    printf("FAIL: test5\n");
    exit(1);
  }
  glutSetWindow(win2);
  if (win2 != glutGetWindow()) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_RED) != 0.0) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_GREEN) != 0.25) {
    printf("FAIL: test5\n");
    exit(1);
  }
  if (glutGetColor(2, GLUT_BLUE) != 0.75) {
    printf("FAIL: test5\n");
    exit(1);
  }
  glutTimerFunc(1500, timeout, 1);
  glutDisplayFunc(display);
  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
/*
 * Class:     gruenewa_opengl_GLUT__
 * Method:    glutCopyColormap
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_gruenewa_opengl_GLUT_00024_glutCopyColormap
  (JNIEnv * jenv, jobject jobj, jint arg1) {
   glutCopyColormap(arg1); 
}