Пример #1
0
int main(int argc, char** argv)
{
	gflags::ParseCommandLineFlags(&argc, &argv, true);
	google::InitGoogleLogging(argv[0]);

	// GLUT Window Initialization:
	glutInit(&argc, argv);
	glutInitWindowSize(640, 480);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutCreateWindow("GlutViewer");

	// Initialize OpenGL graphics state
	initializeGL();

	// Register callbacks
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutMouseFunc(mouseButton);
	glutMotionFunc(mouseMotion);
	glutKeyboardFunc(Keyboard);

	// Create our popup menu
	buildPopupMenu();
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	// To do
	//const char *mesh_filename = "mesh.off";
	//g_MeshViewer.open_mesh(mesh_filename);
	g_MeshViewer.parse_arguments();

	// Turn the flow of control over to GLUT
	glutMainLoop();
	return 0;
}
Пример #2
0
QuickLauncher::QuickLauncher(const TQString& configFile, Type type, int actions,
                             TQWidget *parent, const char *name) : 
    KPanelApplet(configFile, type, actions, parent, name)
{
    DCOPObject::setObjId("QuickLauncherApplet");
    DEBUGSTR << endl << endl << endl << "------------" << flush;
    DEBUGSTR << "QuickLauncher::QuickLauncher(" << configFile << ",...)" <<
                endl << flush;

    m_settings = new Prefs(sharedConfig());
    m_settings->readConfig();

    m_needsSave = false;
    m_needsRefresh = false;
    m_refreshEnabled = false;

    m_configDialog = 0;
    m_popup = 0;
    m_appletPopup = 0;
    m_removeAppsMenu = 0;

    m_dragAccepted = false;

    m_buttons = new ButtonGroup;
    m_manager = new FlowGridManager;
    m_newButtons = 0;
    m_oldButtons = 0;
    m_dragButtons = 0;

    m_configAction = new TDEAction(i18n("Configure Quicklauncher..."), "configure", TDEShortcut(),
        TQT_TQOBJECT(this), TQT_SLOT(slotConfigure()), TQT_TQOBJECT(this));

    m_saveTimer = new TQTimer(this, "m_saveTimer");
    connect(m_saveTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(saveConfig()));

    m_popularity = new PopularityStatistics();

    setBackgroundOrigin(AncestorOrigin);

    loadConfig();

    buildPopupMenu();
    m_minPanelDim = std::max(16, m_settings->iconDimChoices()[1]);
    refreshContents();
    setRefreshEnabled(true);

    setAcceptDrops(true);
    //TQToolTip::add(this, i18n("Drop applications here"));
    DEBUGSTR << "    QuickLauncher::QuickLauncher(" << configFile << 
                ",...) END" << endl << flush;

    DCOPClient *dcopClient = TDEApplication::dcopClient();
    dcopClient->connectDCOPSignal(0, "appLauncher", 
        "serviceStartedByStorageId(TQString,TQString)",
        "QuickLauncherApplet",
        "serviceStartedByStorageId(TQString,TQString)",
        false);
    kdDebug() << "Quicklauncher registered DCOP signal" << endl;
}
Пример #3
0
Osg3dView::Osg3dView(QWidget *parent)
    : QOpenGLWidget(parent)
    , m_viewingCore(new ViewingCore)
    , m_mouseMode(MM_ORBIT)
    , m_mouseIsPressed(false)
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(customMenuRequested(QPoint)));
#if 0   // This would be interesting to have  Perhaps it belongs in OsgForm
        // Alas, it would be hard to design in qtdesigner
        QToolBar *tb = new QToolBar(this);
        tb->addAction("Hello");
        tb->addAction("goodbye");
#endif
    buildPopupMenu();

    // Construct the embedded graphics window
    m_osgGraphicsWindow = new osgViewer::GraphicsWindowEmbedded(0,0,width(),height());
    getCamera()->setGraphicsContext(m_osgGraphicsWindow);

    // Set up the camera
    getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
    getCamera()->setProjectionMatrixAsPerspective(30.0f,
            static_cast<double>(width())/static_cast<double>(height()),
            1.0f,
            10000.0f);
    // By default draw everthing that has even 1 bit set in the nodemask
    getCamera()->setCullMask( (unsigned)~0 );
    getCamera()->setDataVariance(osg::Object::DYNAMIC);

    // As of July 2010 there wasn't really a good way to multi-thread OSG
    // under Qt so just set the threading model to be SingleThreaded
    setThreadingModel(osgViewer::Viewer::SingleThreaded);

    // draw both sides of polygons
    setLightingTwoSided();

    // this will probably be overwritten but avoids warnings
    setScene(new osg::Node);
    update();
}
Пример #4
0
/*
 * Written by Robert "Chip" Senkbeil
 * Uses -lglut, -lGLU, and -lGL to compile on Linux.
 */
int main(int argc, char** argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowPosition(0, 0);
  glutInitWindowSize(640, 640);
  glutCreateWindow(argv[0]);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);

  //glutReshapeFunc(/* ... */);
  glutSpecialFunc(arrowPress);
  glutKeyboardFunc(keyPress);
  glutMouseFunc(mouseEvent);
  glutMotionFunc(mouseMoveEvent);
  glutDisplayFunc(render);
  glutIdleFunc(idleEvent);

  // Build and attach the menu
  buildPopupMenu();
  glutAttachMenu(GLUT_RIGHT_BUTTON);

  // Allocate memory for a new robot
  printf("Allocating new robot...\n");
  robot = new Robot();

  // Add robot initial keyframe to animation clip
  {
    Keyframe k_;
    k_.getKeyframeFromRobot(robot);
    aClip.addKeyframeAtCurrent(k_);
  }

  printf("Setting up the camera...\n");
  camera.setCameraMaxDistance(4.0f);
  //camera.lock();

  // Set default fps
  framesPerSecond = DEFAULT_FRAMES_PER_SECOND;
  isPlaying = 0;
  playingForward = 1;
  playingBackward = 0;
  currentTime = 0;
  baseTime = 0;
  frames = 0;
  framesTotal = 0;

  // Set termination callback
  atexit(terminate_prog);

  // Enable lighting
  setupLight();

  // Setup a global material
  initMaterial();

  // Enable texture
  glEnable(GL_TEXTURE_2D);
  robot->loadTexture("texture/CorrugatedSharp.png");

  // Start the main loop
  glutMainLoop();

  // Exit program
  return 0;
}