Beispiel #1
0
void keyboard(unsigned char c, int x, int y)
{
    switch (c) {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
        shaderMenu(c-'0');
        break;
    case 27:  /* Esc quits */
        exit(0);
        return;
    case 13:  /* Enter redisplays */
        break;
    case 'w':
        toggleWireframe();
        break;
    case 'V':
        verbose = !verbose;  // toggle
        break;
    case 'v':
       use_vsync = !use_vsync;
       printf("use vsync = %s\n", use_vsync ? "enabled" : "disabled");
       requestSynchornizedSwapBuffers(use_vsync);
       break;
    case 'f':
        break;
    case 'B':
        bump_height -= 0.2;
        // Fallthrough...
    case 'b':
        bump_height += 0.1;
        printf("bump_height = %f\n", bump_height);

        material->normal_map->load(bump_height);
        material->normal_map->tellGL();

        material->bindTextures();
        break;
    default:
        return;
    }
    glutPostRedisplay();
}