コード例 #1
0
int main() {
    win1.add(new StandardWindowKeyControls);
    win1.create(Window::Dim(800, 600));

    MainLoop::start();
    return 0;
}
コード例 #2
0
ファイル: Main.cpp プロジェクト: jslee02/dart
int main(int argc, char* argv[])
{
  // load a skeleton file
  // create and initialize the world
  dart::simulation::World* myWorld
      = dart::utils::SkelParser::readWorld(
          DART_DATA_PATH"skel/soft_open_chain.skel");
  assert(myWorld != NULL);

  int dof = myWorld->getSkeleton("skeleton 1")->getNumGenCoords();
  Eigen::VectorXd initPose = Eigen::VectorXd::Zero(dof);
  for (int i = 0; i < 3; i++)
    initPose[i] = dart::math::random(-0.5, 0.5);
  myWorld->getSkeleton("skeleton 1")->setConfigs(initPose, true, true, false);

  // create a window and link it to the world
  MyWindow window;
  window.setWorld(myWorld);

  std::cout << "space bar: simulation on/off" << std::endl;
  std::cout << "'p': playback/stop" << std::endl;
  std::cout << "'[' and ']': play one frame backward and forward" << std::endl;
  std::cout << "'v': visualization on/off" << std::endl;
  std::cout << "'1'--'4': programmed interaction" << std::endl;

  glutInit(&argc, argv);
  window.initWindow(640, 480, "Soft Open Chain");
  glutMainLoop();

  return 0;
}
コード例 #3
0
ファイル: Main.cpp プロジェクト: bingjeff/dart
int main(int argc, char* argv[])
{
    // load a skeleton file
    FileInfoSkel<SkeletonDynamics> model;
    model.loadFile(DART_DATA_PATH"/skel/Chain.skel", SKEL);
    
    // create and initialize the world
    World *myWorld = new World();
    Vector3d gravity(0.0, -9.81, 0.0);
    myWorld->setGravity(gravity);
    myWorld->setTimeStep(1.0/2000);

    myWorld->addSkeleton((SkeletonDynamics*)model.getSkel());
    int nDof =  myWorld->getSkeleton(0)->getNumDofs();
    VectorXd initPose(nDof);
    for (int i = 0; i < nDof; i++)
        initPose[i] = random(-0.5, 0.5);
    myWorld->getSkeleton(0)->setPose(initPose);

    // create a window and link it to the world
    MyWindow window;
    window.setWorld(myWorld);
  
    glutInit(&argc, argv);
    window.initWindow(640, 480, "Forward Simulation");
    glutMainLoop();

    return 0;
}
コード例 #4
0
int main(){

	for(int i=0; i<800; ++i){
		int Nv = rnd::prob(0.5)
					? (rnd::prob(0.5) ? addCube(shapes) : addDodecahedron(shapes))
					: addIcosahedron(shapes);
		
		Mat4f xfm;
		xfm.setIdentity();
		xfm.scale(Vec3f(rnd::uniform(1.,0.1), rnd::uniform(1.,0.1), rnd::uniform(1.,0.1)));
		xfm.translate(Vec3f(rnd::uniformS(8.), rnd::uniformS(8.), rnd::uniformS(8.)));
		//xfm.rotate(rnd::uniform(), rnd::uniform(), rnd::uniform());
		
		shapes.transform(xfm, shapes.vertices().size()-Nv);

		for(int i=0; i<Nv; ++i){
			float f = float(i)/Nv;
			shapes.color(HSV(f*0.1+0.2,1,1));
		}
	}

	shapes.primitive(Graphics::TRIANGLES);
	shapes.decompress();
	shapes.generateNormals();


	win1.add(new StandardWindowKeyControls);

	win1.create(Window::Dim(800, 600));

	MainLoop::start();
	return 0;
}
コード例 #5
0
ファイル: ShaderToyViewer.cpp プロジェクト: 2php/nvFX
/////////////////////////////////////////////////////////////////////////
// Main initialization point
//
int sample_main(int argc, const char** argv)
{
    NVPWindow::ContextFlags context(
    3,      //major;
    3,      //minor;
    false,   //core;
    1,      //MSAA;
    true,   //debug;
    false,  //robust;
    false,  //forward;
    NULL   //share;
    );

    g_myWindow.argc = argc;
    g_myWindow.argv = argv;

    if(!g_myWindow.create("bk3d viewer", &context))
        return false;

    g_myWindow.makeContextCurrent();
    g_myWindow.swapInterval(0);

    while(MyWindow::sysPollEvents(false) )
    {
        idle();
    }
    return true;
}
コード例 #6
0
ファイル: Main.cpp プロジェクト: bchretien/dart
int main(int argc, char* argv[]) {
  // create and initialize the world
  dart::simulation::World *myWorld
      = dart::utils::SkelParser::readWorld(
          DART_DATA_PATH"/skel/bullet_collision.skel");
  assert(myWorld != NULL);
  Eigen::Vector3d gravity(0.0, -9.81, 0.0);
  myWorld->setGravity(gravity);

  // create a window and link it to the world
  MyWindow window;
  window.setWorld(myWorld);

  std::cout << "space bar: simulation on/off" << std::endl;
  std::cout << "'p': playback/stop" << std::endl;
  std::cout << "'[' and ']': play one frame backward and forward" << std::endl;
  std::cout << "'v': visualization on/off" << std::endl;
  std::cout << "'1'--'4': programmed interaction" << std::endl;
  std::cout << "'q': spawn a random cube" << std::endl;
  std::cout << "'w': delete a spawned cube" << std::endl;

  glutInit(&argc, argv);
  window.initWindow(640, 480, "Bullet Collision");
  glutMainLoop();

  return 0;
}
コード例 #7
0
int main()
{
	MyWindow w;
	w.create();		// 이 순간 윈도우가 만들어져야 합니다.
					// 왼쪽 버튼을 누르면 "LButton" 이라고 출력되어야 합니다.
	IoProcessMessage();
}
コード例 #8
0
//-----------------------------------------------------------------------------
MyWindow* createWindow( int width, int height )
//-----------------------------------------------------------------------------
{
    MyWindow* pWindow = new MyWindow( width, height );
    if( pWindow->can_do() == 0 )
    {
        cout << "OpenGL not possible!!" << endl;
    }
    else
    {
        cout << "Using OpenGL." << endl;
        if( pWindow->can_do_overlay() == 0 )
        {
            cout << "OpenGL Overlays not possible!!" << endl;
        }
        else
        {
            cout << "Using OpenGL Overlays." << endl;
        }

        //window->clear_border();
        gl_font( FL_TIMES, 12 );
        Fl::gl_visual( FL_RGB );
        pWindow->end();
        pWindow->show();
    }
    return pWindow;
}
コード例 #9
0
int main()
{
	MyWindow w;
	w.Create();				// 이 순간 윈도우가 생성되어야 합니다.
							// LBUTTON누르면 "LButton" 출력 되어야 합니다.
	IoProcessMessage();		// 종료하지 말고 메시지를 처리해달라.
}
コード例 #10
0
ファイル: Main.cpp プロジェクト: indivisibleatom/dart
int main(int argc, char* argv[])
{
  // load a skeleton file
  // create and initialize the world
  dart::simulation::SoftWorld *myWorld
      = dart::utils::SoftSkelParser::readSoftFile(
          DART_DATA_PATH"skel/test/test_single_pendulum.skel");
  assert(myWorld != NULL);

  // create a window and link it to the world
  MyWindow window;
  window.setWorld(myWorld);

  std::cout << "space bar: simulation on/off" << std::endl;
  std::cout << "'p': playback/stop" << std::endl;
  std::cout << "'[' and ']': play one frame backward and forward" << std::endl;
  std::cout << "'v': visualization on/off" << std::endl;
  std::cout << "'1'--'4': programmed interaction" << std::endl;

  glutInit(&argc, argv);
  window.initWindow(640, 480, "Soft Single Pendulum");
  glutMainLoop();

  return 0;
}
コード例 #11
0
ファイル: Main.cpp プロジェクト: hsu/dart
int main(int argc, char* argv[])
{
    // load a skeleton file
    // create and initialize the world
    dart::simulation::World* myWorld
            = dart::utils::readSkelFile(DART_DATA_PATH"/skel/chain.skel");
    assert(myWorld != NULL);
    
    // create and initialize the world
    Eigen::Vector3d gravity(0.0, -9.81, 0.0);
    myWorld->setGravity(gravity);
    myWorld->setTimeStep(1.0/2000);

    int dof =  myWorld->getSkeleton(0)->getDOF();
    Eigen::VectorXd initPose(dof);
    for (int i = 0; i < dof; i++)
        initPose[i] = random(-0.5, 0.5);
    myWorld->getSkeleton(0)->setPose(initPose);

    // create a window and link it to the world
    MyWindow window;
    window.setWorld(myWorld);
  
    glutInit(&argc, argv);
    window.initWindow(640, 480, "Forward Simulation");
    glutMainLoop();

    return 0;
}
コード例 #12
0
ファイル: main.cpp プロジェクト: monchi59/crazyMichel
int main(int argc, char** argv) {
    
    
    CrazyContainer *container = new CrazyContainer();
    container->loadXML();
    MyWindow *window = new MyWindow();
    window->setCrazyContainer(container);
        
    Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "Connect");
    b1->callback(connect,(void *)container);
    
    Fl_Button *b2 = new Fl_Button(100, 20, 80, 25, "Go 11000");
    b2->callback(run,(void *)container);
    FLContainer::thrustOutput = new Fl_Value_Slider(100,50,250,25,"Thrust meter");
    FLContainer::thrustOutput->type(FL_HOR_FILL_SLIDER);
    FLContainer::thrustOutput->scrollvalue(5000, 100, 5000, 100000);
    FLContainer::thrustOutput->callback(runCustomThrust,(void *)container); 
    
    FLContainer::pitch = new Fl_Value_Slider(100,100,250,25,"Pitch");
    FLContainer::pitch->type(FL_HORIZONTAL);
    FLContainer::pitch->scrollvalue(0,10,-180,370);
    FLContainer::pitch->precision(2);
    FLContainer::roll = new Fl_Value_Slider(100,140,250,25,"Roll");
    FLContainer::roll->type(FL_HORIZONTAL);
    FLContainer::roll->scrollvalue(0,10,-180,370);
    FLContainer::roll->precision(2);
    FLContainer::yaw = new Fl_Value_Slider(100,180,250,25,"Yaw");
    FLContainer::yaw->type(FL_HORIZONTAL);
    FLContainer::yaw->scrollvalue(0,10,-180,370);
    FLContainer::yaw->precision(2);
    FLContainer::offsetPitch = new Fl_Value_Slider(100,220,250,25,"Offset Pitch");
    FLContainer::offsetPitch->type(FL_HORIZONTAL);
    FLContainer::offsetPitch->scrollvalue(container->getOffsetPitch(),10,-20,50);
    FLContainer::offsetPitch->precision(2);
    FLContainer::offsetPitch->callback(setOffsetPitch,(void *)container);
    FLContainer::offsetRoll = new Fl_Value_Slider(100,260,250,25,"Offset Roll");
    FLContainer::offsetRoll->type(FL_HORIZONTAL);
    FLContainer::offsetRoll->scrollvalue(container->getOffsetRoll(),10,-20,50);
    FLContainer::offsetRoll->precision(2);
    FLContainer::offsetRoll->callback(setOffsetRoll,(void *)container);
    
     Fl_Button *b3 = new Fl_Button(200, 20, 80, 25, "Stop");
    b3->callback(stop,(void *)container);
    
    Fl_Button *bfocus = new Fl_Button(20, 45, 80, 25, "Focus");
    
     Fl_Button *b5 = new Fl_Button(400, 20, 80, 25, "Kill n' Exit");
    b5->callback(killnstop,(void *)container);
    
    Fl_Button *bsave = new Fl_Button(500, 20, 80, 25, "Plot");
    bsave->callback(save,(void *)container);
    
    Fl_Button *bload = new Fl_Button(500, 50, 80, 25, "Load");
    bload->callback(load,(void *)container);
    
    
    window->end();
    window->show(argc,argv);
    return Fl::run();
}
コード例 #13
0
ファイル: func.cpp プロジェクト: tokar1/mech-math
/////////////////////////////////////////////////////////////
// Main: initialize X, create an instance of MyWindow class,
//       and start the message loop
int main() {
    // Initialize X stuff
    if (!GWindow::initX()) {
        printf("Could not connect to X-server.\n");
        exit(1);
    }

    MyWindow w;
    w.createWindow(
        I2Rectangle(                    // Window frame rectangle:
            I2Point(10, 10),            //     left-top corner
            GWindow::screenMaxX()/2,    //     width
            GWindow::screenMaxY()/2     //     height
        ),
        R2Rectangle(                    // Coordinate rectangle:
            R2Point(-12., -9.),         //     bottom-right corner
            24., 18.                    //     width, height
         ),
        "Graph of Function"             // Window title
    );
    w.setBackground("lightGray");

    GWindow::messageLoop();

    GWindow::closeX();
    return 0;
}
コード例 #14
0
int main(){
	MyWindow win;
	GLVDetachable gui;
	glv::Table layout("><");

	// Create some random widgets for testing
	glv::Button btn;
	glv::Sliders sld(glv::Rect(100,10*4), 1,4);
	glv::Slider2D sld2;

	btn.colors().set(glv::Color(1,0,0));
	layout.enable(glv::DrawBack);
	//layout.enable(glv::Controllable | glv::HitTest);
	//layout.addHandler(glv::Event::MouseDrag, glv::Behavior::mouseMove);

	layout
		<< gui.detachedButton() << new glv::Label("detach")
		<< btn << new glv::Label("param 1")
		<< sld << new glv::Label("param 2")
		<< sld2<< new glv::Label("param 3")
	;

	gui << layout;
	layout.arrange();

	// We must assign a parent window to the GUI
	gui.parentWindow(win);

	win.append(*new StandardWindowKeyControls);
	win.create();

	MainLoop::start();
}
コード例 #15
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MyWindow window;
    window.showMaximized();

    QThread thread;
    Detector *detector = new Detector();
    detector->moveToThread(&thread);
    detector->connect(&thread,SIGNAL(started()),SLOT(work()));


    QThread thread2;
    MyBluetooth *bt = new MyBluetooth();
    bt->moveToThread(&thread2);
    bt->connect(&thread2,SIGNAL(started()),SLOT(scanList()));
    bt->connect(&window,SIGNAL(updateScan()),SLOT(scanList()));
    bt->connect(detector,SIGNAL(detected()),SLOT(checkAlert()));

    //typedef std::list<Phone> listPhone;
    qRegisterMetaType<std::list<Phone*> >("List<Phone>");
    window.connect(bt,SIGNAL(finishedScan(std::list<Phone*>)),SLOT(setList(std::list<Phone*>)));
    window.connect(bt,SIGNAL(finishedCheck(std::list<Phone*>)),SLOT(checkAlert(std::list<Phone*>)));

    thread.start();
    thread2.start();

    return a.exec();
}
コード例 #16
0
int main(int argc, char **argv) {

	SDL_Event e;

	MyWindow* window = new MyWindow("Handle Key Press Event", 800, 600);
	
	window->updateSurface(bmpDefault->getSurface());

	while (window->isRunning()) {
		while (SDL_PollEvent(&e)) {
			switch (e.type)
			{
			case SDL_QUIT:
				window->setRunning(false);
				break;
			case SDL_KEYDOWN:
				handleKeyDownEvent(e, window);
				break;
			default:
				break;
			}
		}
	}

	closeSDL(window->getWindow());

	return 0;
}
コード例 #17
0
ファイル: utIOWindowGL.cpp プロジェクト: gitelope/AlloSystem
int utIOWindowGL(){

	MyWindow win;
	MyWindow win2;
	
	
//	struct Func:TimedFunction{
//		void onExecute(){ printf("hello\n"); }
//	};
//
//	Func tf;
//	tf(1000);

	win.create(Window::Dim(100,0, 200,200), "Window 1", 40);
	win2.create(Window::Dim(300,0, 200,200), "Window 2", 40);
//	win2.create(Window::Dim(200,200,300), "Window 2", 40, SingleBuf);

	win.freqs(1,2);
	win2.freqs(3,4);

//win.cursorHide(true);

	Window::startLoop();
	return 0;
}
コード例 #18
0
ファイル: main.cpp プロジェクト: jgleesawn/fltk_opengl
void ccallback(void * this_ptr) {
	MyWindow * t = (MyWindow *)this_ptr;
	t->Pstep();

	((MyWindow *)this_ptr)->redraw();
	
	Fl::repeat_timeout(1.0/10.0, (func_ptr)ccallback, this_ptr);
}
コード例 #19
0
ファイル: 7.cpp プロジェクト: milrob/patternformation
int main(){
	iso.primitive(Graphics::TRIANGLES);

	win.create(Window::Dim(800,600), "Rob's Game of Life", 140);
	win.add(new StandardWindowKeyControls);
	win.add(new NavInputControl(nav));
	Window::startLoop();
}
コード例 #20
0
ファイル: main.cpp プロジェクト: Imarion/GLSLCBChap3Cartoon
int main(int argc, char *argv[])
{
    QGuiApplication a(argc, argv);

    MyWindow *window = new MyWindow();
    window->show();

    return a.exec();
}
コード例 #21
0
int main(){

	double world_radius = 50;

	nav.smooth(0.8);
	lens.near(1).far(world_radius);

	// set up mesh:
	mesh.primitive(Graphics::TRIANGLES);
	double tri_size = 2;
	int count = 4000;
	for (int i=0; i<count; i++) {
		double x = rnd::uniformS(world_radius);
		double y = rnd::uniformS(world_radius);
		double z = rnd::uniformS(world_radius);
		for (int v=0; v<3; v++) {
			mesh.color(HSV(float(i)/count, v!=2, 1));
			mesh.vertex(x+rnd::uniformS(tri_size), y+rnd::uniformS(tri_size), z+rnd::uniformS(tri_size));
		}
	}

	// set up grid:
	grid.primitive(Graphics::LINES);
	double stepsize = 1./2;
	for (double x=-1; x<=1; x+= stepsize) {
	for (double y=-1; y<=1; y+= stepsize) {
		grid.vertex(x, y, 1);
		grid.vertex(x, y, -1);
	}}
	for (double x=-1; x<=1; x+= stepsize) {
	for (double z=-1; z<=1; z+= stepsize) {
		grid.vertex(x, 1, z);
		grid.vertex(x, -1, z);
	}}
	for (double y=-1; y<=1; y+= stepsize) {
	for (double z=-1; z<=1; z+= stepsize) {
		grid.vertex(1, y, z);
		grid.vertex(-1, y, z);
	}}
	grid.scale(world_radius);

	// set up cube:
	cube.color(1,1,1,1);
	cube.primitive(Graphics::TRIANGLES);
	addCube(cube);
	cube.generateNormals();

	win.create(Window::Dim(100, 0, 640, 480), "Cube Map FBO Example", 60);
	win.displayMode(win.displayMode() | Window::STEREO_BUF);
	win.add(new StandardWindowKeyControls);
	win.add(new NavInputControl(nav));

	MainLoop::start();

    return 0;
}
コード例 #22
0
ファイル: Main.cpp プロジェクト: jslee02/wafr2016
//==============================================================================
int main(int argc, char* argv[])
{
  // create and initialize the world
  auto world = std::make_shared<simulation::World>();
  assert(world != nullptr);

  // create and initialize the world
  Eigen::Vector3d gravity(0.0, -9.81, 0.0);
  //world->setGravity(Eigen::Vector3d::Zero());
  world->setGravity(gravity);
  world->setTimeStep(1.0/1000);

  const auto numLinks = 10;
  const auto l = 1.0;
  auto skel = createNLinkRobot(numLinks, Vector3d(0.3, 0.3, l), DOF_ROLL);
//  auto skel = createNLinkRobot(numLinks, Vector3d(0.3, 0.3, l), BALL);
  world->addSkeleton(skel);

  const auto posLower = math::constantsd::pi() * -0.1;
  const auto posUpper = math::constantsd::pi() *  0.1;
  const auto velLower = math::constantsd::pi() * -0.1;
  const auto velUpper = math::constantsd::pi() *  0.1;
  for (auto i = 0u; i < numLinks; ++i)
  {
    auto joint = skel->getJoint(i);

    const auto pos = math::random(posLower, posUpper);
    const auto vel = math::random(velLower, velUpper);

    for (auto j = 0u; j < joint->getNumDofs(); ++j)
    {
      joint->setPosition(j, pos);
      joint->setVelocity(j, vel);
    }
  }

  world->dm_initialize_RIQN_DRNEA();

//  while (world->getTime() < 60.0)
//  {
//    std::cout << "time: " << world->getTime() << std::endl;
//    world->dm_step();
//  }

//  std::cout << "E: " << world->getSkeleton(0)->getTotalEnergy() << std::endl;

  // create a window and link it to the world
  MyWindow window;
  window.setWorld(world);

  glutInit(&argc, argv);
  window.initWindow(640, 480, "Forward Simulation");
  glutMainLoop();

  return 0;
}
コード例 #23
0
//-----------------------------------------------------------------------------
MyWindow* createWindow( int width, int height )
//-----------------------------------------------------------------------------
{
    MyWindow* pWindow = new MyWindow( width, height );
    //pWindow->clear_border();
    fl_font( FL_TIMES, 12 );
    pWindow->end();
    Fl::visual( FL_RGB | FL_DOUBLE | FL_INDEX );
    return pWindow;
}
コード例 #24
0
ファイル: main.cpp プロジェクト: jgleesawn/fltk_opengl
int main(int argc, char **argv) {
	int num = 1024;
	if(argc > 1){
		num = atoi(argv[1]);
	}
	MyWindow *window = new MyWindow(20,40,300,180,"Hellow, World!", num);
//	Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
	window->show(argc, argv);
	return Fl::run();
}
コード例 #25
0
int main(int argc, char **argv) {

	if (!initSDL())
		return 1;

	MyWindow *window = new MyWindow("Running animation");
	window->show();

	quitSDL();
	return 0;
}
コード例 #26
0
int main (void)
{   window.size(200,200);
	window.top();
	window.activate();
	menu.add(IDM_Exit,doexit);
	menu.add(IDM_Help,dohelp);
	menu.add(IDM_Parameter,parameter);
	menu.add(IDM_Save,dosave);
	window.loop();
	return 0;
}
コード例 #27
0
ファイル: main.cpp プロジェクト: kuailexs/symbiandump-mw1
TX_MAIN(argc, argv) {
    TX_STATIC_ENTRY
    HbApplication app(argc, argv);
    app.setApplicationName("Cache proxy model demo");
    MyWindow mainWindow;
    mainWindow.show();
    // Enter event loop
    int ret = app.exec();
    TX_STATIC_EXIT
    return ret;
}
コード例 #28
0
int main() {
  MyWindow w;
  w.Create();

  ImageView w2;
  w2.Create();

  w.addChild(&w2);

  IoProcessMessage();
}
コード例 #29
0
ファイル: main.cpp プロジェクト: Drewwit/VRWorkstation
void drawScreenSurface(){
    //TODO : WindowPosition for mouse()
    glEnable(GL_TEXTURE_2D);
    for (int i = 0 ; i < myFinder->getNbWindows(); i++){
        MyWindow* currentWindow = myFinder->getAnchorWindow(i);
        currentWindow->setConfiguration(i);
        if(currentWindow!=NULL){
            currentWindow->findAllChilds();
            drawWindow(currentWindow,0);
        }
    }
}
コード例 #30
0
int main(int argc, char **argv) {
    MyWindow *window = new MyWindow();

    vector<string> args;
    for(int i = 0; i < argc; ++i)
        args.push_back(argv[i]);
    process(args, window);

    window->show();

    return Fl::run();
}