コード例 #1
0
// react to keys
void keyboard(unsigned char k, int x, int y)
{
    switch(k)
    {
        case 27:
        case 'q':
            _scene       = NULL;
            _point1_core = NULL;
            _point2_core = NULL;
            _point3_core = NULL;

            point1_beacon = NULL;
            point2_beacon = NULL;
            point3_beacon = NULL;

            _mgr          = NULL;

            OSG::osgExit();

            exit(1);
        break;
        case 'w':
            OSG::SceneFileHandler::the()->write(_scene, "scene.osb.gz", true);
            printf("wrote scene.osb.gz\n");
        break;
        case '1':
        {
            if(_point1_core->getOn() == false)
                _point1_core->setOn(true);
            else
                _point1_core->setOn(false);
            break;
        }

        case '2':
        {
            if(_point2_core->getOn() == false)
                _point2_core->setOn(true);
            else
                _point2_core->setOn(false);
            break;
        }

        case '3':
        {
            if(_point3_core->getOn() == false)
                _point3_core->setOn(true);
            else
                _point3_core->setOn(false);
            break;
        }
    }

    glutPostRedisplay();
}
コード例 #2
0
// react to keys
void keyboard(unsigned char k, int x, int y)
{
    switch(k)
    {
        case 27:
        case 'q':
            _scene       = NULL;
            _point1_core = NULL;
            _point2_core = NULL;
            _point3_core = NULL;

            shl          = NULL;

            delete _mgr;

            exit(1);
        break;
        case 'w':
            OSG::SceneFileHandler::the()->write(_scene, "scene.osb.gz", true);
            printf("wrote scene.osb.gz\n");
        break;
        case '1':
        {
            if(_point1_core->getOn() == false)
                _point1_core->setOn(true);
            else
                _point1_core->setOn(false);
            break;
        }

        case '2':
        {
            if(_point2_core->getOn() == false)
                _point2_core->setOn(true);
            else
                _point2_core->setOn(false);
            break;
        }

        case '3':
        {
            if(_point3_core->getOn() == false)
                _point3_core->setOn(true);
            else
                _point3_core->setOn(false);
            break;
        }

        case 'i':
            shl->subUniformParameter("OSGLight0Active");
            break;
        case 'I':
            shl->setUniformParameter("OSGLight0Active", 0);
            break;
        case 'o':
            shl->subUniformParameter("OSGLight1Active");
            break;
        case 'O':
            shl->setUniformParameter("OSGLight1Active", 0);
            break;
        case 'p':
            shl->subUniformParameter("OSGLight2Active");
            break;
        case 'P':
            shl->setUniformParameter("OSGLight2Active", 0);
            break;
    }

    glutPostRedisplay();
}