コード例 #1
0
//------------------------------------------------------------------------------
GUITeamSelect::GUITeamSelect(PuppetMasterClient * puppet_master) :
    puppet_master_(puppet_master)
{
    enableFloatingPointExceptions(false);

    CEGUI::WindowManager& wm = CEGUI::WindowManager::getSingleton();

    /// XXX hack because root window is stored inside metatask, no easy way to retrieve it
    CEGUI::Window * parent = wm.getWindow("TankApp_root/");
    
    // Use parent window name as prefix to avoid name clashes
    root_ = wm.loadWindowLayout("teamselectmenu.layout", parent->getName());
    menu_window_ = (CEGUI::Window*) wm.getWindow(parent->getName() + "teamselectmenu/menu");
    menu_btn_[0] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn1");
    menu_btn_[1] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn2");
    menu_btn_spec_ = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn3");
    menu_btn_text_[0] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn1/text");
    menu_btn_text_[1] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn2/text");


    // add score to widget tree
    parent->addChildWindow(menu_window_);

    menu_window_->setVisible(false);

    registerCallbacks();

    enableFloatingPointExceptions();


    s_input_handler.registerInputCallback("Change Team",
                                          input_handler::SingleInputHandler(this, &GUITeamSelect::toggleShow),
                                          &fp_group_);
}
コード例 #2
0
ファイル: context.cpp プロジェクト: DerRM/CG1
void Context::init(int argc, char **argv){

  // configurate contexts
  config();

  // create window with glut
  glutInit(&argc, argv);

  glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
  glutInitWindowSize(width, height);
  glutInitWindowPosition(x, y);
  glutCreateWindow(title.c_str());
   
  // light and material
  glMaterialfv(GL_FRONT, GL_AMBIENT, materialAmbient);
  glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);
  glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess);
  glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightModelAmbient);
  
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  
  // shading
  glShadeModel(GL_FLAT);
  
  // clear background to black and clear depth buffer
  glClearColor(0.0,0.0,0.0,1.0);
  
  // enable depth test (z-buffer)
  glDepthFunc(GL_LESS);
  glEnable(GL_DEPTH_TEST);
  
  // enable normalization of vertex normals
  glEnable(GL_NORMALIZE);
  
  // initial view definitions
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  // perspective projection
  gluPerspective(fov, width/height, nearPlane, farPlane);

  registerCallbacks();

  // some output to console
  cout << "--------------------------------------------\n";
  cout << " cg1_ex1 opengl robot scenegraph            \n";
  cout << "                                            \n";
  cout << " keyboard:                                  \n";
  cout << " arrow keys: select node                    \n";
  cout << " x/X,y/Y,z/Z: rotate node                   \n";
  cout << " r: reset all rotations                     \n";
  cout << " q/Q: quit program                          \n";
  cout << "                                            \n";
  cout << " mouse:                                     \n";
  cout << " right click: config menu                   \n";
  cout << " left click+drag: rotate selected node      \n";
  cout << "--------------------------------------------\n";
}
コード例 #3
0
void Object::init ()
{
  /* Set up magic object back link */
  evas_object_data_set( o, "obj_c++", this );

  /* Set up callbacks */
  registerCallbacks();
}
コード例 #4
0
ファイル: Source.cpp プロジェクト: Tauqeer1/Graphics-Lab
void main(int argc, char **argv)
{
	glutInit(&argc, argv);	//Initialize the tool kit
	initWindow();
	registerCallbacks();
	initializeGraphics();
	glutMainLoop();

}
コード例 #5
0
ファイル: ARtest.cpp プロジェクト: markkorput/ARtoolkitTest
void ARtest::destroy(){
    registerCallbacks(false);

    #define DELPLOT(x) if(x){ delete x; x = NULL; }
    DELPLOT(plot1);
    DELPLOT(plot2);
    DELPLOT(plot3);
    #undef DELPLOT
}
コード例 #6
0
ファイル: glAusgabe.c プロジェクト: hotfix/Studium
void zeigeMatrizen(Matrix* matrizen, int n)
{
	int i;
	GLfloat x,y;
	TTexture texture;
	char* arg0 = "ueb04";
	int argc = 1;

	/* Anzahl der Matrizen pruefen */
	if (n<0) return;
	if (n>12) n=12;

	/* Initialisieren des Fensters */
	glutInit(&argc,&arg0);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(800,600);
	glutInitWindowPosition(0,0);

	/* Erzeugen des Fensters, Initialisierung v. Anwendung und Callbacks */
	if (!glutCreateWindow("C-Uebung Aufgabe 4 OpenGL-Fenster") || !init() || !registerCallbacks()) return;

	/* Speicher fuer Textur reservieren */
	texture.pixel=malloc(256*256*sizeof(GLfloat));

	/* TextureIDs erzeugen */
	textureIDs=malloc(n*sizeof(GLuint));
	glGenTextures(n,textureIDs);

	/* Matrizen in Texturen konvertieren und anzeigen */
	nquads=n;
	x=-0.9f;
	y=0.7f;
	for (i=0; i<n; i++)
	{
		matrixToTexture(matrizen[i],&texture);
		bindTexture(i,texture);
		rects[i].x=x;
		rects[i].y=y;
		rects[i].width=(GLfloat)texture.orgwidth/256.0f*0.4f;
		rects[i].height=(GLfloat)texture.orgheight/256.0f*0.4f;
		rects[i].xTexAspect=(GLfloat)texture.orgwidth/(GLfloat)texture.width;
		rects[i].yTexAspect=(GLfloat)texture.orgheight/(GLfloat)texture.height;
		x+=(0.4f+0.2f/3.0f);
		if ((i%4)==3)
		{
			x=-0.9f;
			y-=0.5f;
		}
	}

	/* Hauptschleife der Ereignisbehandlung starten */
	glutMainLoop();
}
コード例 #7
0
ファイル: ARtest.cpp プロジェクト: markkorput/ARtoolkitTest
void ARtest::setup(){
    vidGrabber.initGrabber(width, height);
    colorImage.allocate(width, height);
    grayImage.allocate(width, height);
    grayThres.allocate(width, height);

    
    // This uses the default camera calibration and marker file
    artk.setup(width, height);
    LIVEOSC.setup();

    // The camera calibration file can be created using GML:
    // http://graphics.cs.msu.ru/en/science/research/calibration/cpp
    // and these instructions:
    // http://studierstube.icg.tu-graz.ac.at/doc/pdf/Stb_CamCal.pdf
    // This only needs to be done once and will aid with detection
    // for the specific camera you are using
    // Put that file in the data folder and then call setup like so:
    // artk.setup(width, height, "myCamParamFile.cal", "markerboard_480-499.cfg");

    // Set the threshold
    // ARTK+ does the thresholding for us
    // We also do it in OpenCV so we can see what it looks like for debugging
    artk.setThreshold(threshold);
   
    plot1 = new ofxHistoryPlot(NULL, "dbg", 400, false);
    plot1->setAutoRangeShrinksBack(true);
    plot2 = new ofxHistoryPlot(NULL, "dbg", 400, false);
    plot2->setAutoRangeShrinksBack(true);
    plot3 = new ofxHistoryPlot(NULL, "dbg", 400, false);
    plot3->setAutoRangeShrinksBack(true);

    for(int i=0; i<5; i++){
        ofImage* img = new ofImage();
        img->loadImage("portrets/"+ofToString(i+1, 0, 2, '0')+".jpg");
        img->resize(150, 150);
        portrets.push_back(img);
    }

    // Load the corners of the image into the vector
    displayImageCorners.push_back(ofPoint(0, 0));
    displayImageCorners.push_back(ofPoint(150, 0));
    displayImageCorners.push_back(ofPoint(150, 150));
    displayImageCorners.push_back(ofPoint(0, 150));

    updateParams();
    
    // callbacks
    registerCallbacks();
}
コード例 #8
0
ファイル: glutcanvas.cpp プロジェクト: alvatar/smartmatter
void GLUTCanvas::init() {
    glutInitDisplayMode(getDisplayMode());

    atexit(onExitFunction); // FIXME: sholdn't this be part of GLUTApplication??

    glutInitWindowSize(size_.x, size_.y);
    glutCreateWindow(title_.c_str());

    windowID_ = glutGetWindow();
    Canvases_[windowID_] = this;
    registerCallbacks();

    rgbaSize_ = ivec4(glutGet(GLUT_WINDOW_RED_SIZE),
                      glutGet(GLUT_WINDOW_GREEN_SIZE),
                      glutGet(GLUT_WINDOW_BLUE_SIZE),
                      glutGet(GLUT_WINDOW_ALPHA_SIZE)) ;
    stencilSize_ = glutGet(GLUT_WINDOW_STENCIL_SIZE);
    depthSize_ = glutGet(GLUT_WINDOW_DEPTH_SIZE);
    doubleBuffered_ = (0 != glutGet(GLUT_WINDOW_DOUBLEBUFFER));
    stereoViewing_ =  (0 != glutGet(GLUT_WINDOW_STEREO));

    GLCanvas::init();
}
コード例 #9
0
ファイル: Labyrinth.cpp プロジェクト: tmfset/labyrinth
void Labyrinth::init(int* argc, char** argv, int w, int h) {
    m_w_width  = 800;
    m_w_height = 800;
    
    m_key_u_press = false;
    m_key_d_press = false;
    m_key_l_press = false;
    m_key_r_press = false;
    m_key_u_val   = 119;    // w
    m_key_l_val   = 97;     // a
    m_key_d_val   = 115;    // s
    m_key_r_val   = 100;    // d

    m_maze_offset_x = m_w_width/2;
    m_maze_offset_y = m_w_height/2;
    m_max_maze_size = 10;
    m_light_radius  = 50;

    m_film_grain = false;
    m_film_grain_val = 400;
    m_show_data  = false;
    m_splash_screen = true;

    m_frame_count = 0;
    m_frame_time  = 0;
    m_fps         = 0;

    if(!m_screen)
        m_screen = new Screen(w,h);
    if(!m_maze)
        m_maze   = new Maze();
    if(!m_player)
        m_player = new Player(m_maze->nodeAt(0,0));
    
    initGLUT(argc,argv);
    registerCallbacks();
}
コード例 #10
0
ファイル: game.cpp プロジェクト: jrd730/Ablockalypse
void Game::run() {
    initGame();
    registerCallbacks();
    glutMainLoop();
}
コード例 #11
0
ファイル: XML.cpp プロジェクト: pcontezini/pieroshell
XML::XML(): DomTree("", "UTF-8", "1.0") {
	registerCallbacks();
}
コード例 #12
0
ファイル: ofxNeuron.cpp プロジェクト: naus3a/ofxNeuron
ofxNeuron::ofxNeuron(){
	sockTCPRef = NULL;
	bCallbacks = false;

	registerCallbacks();
}
コード例 #13
0
ファイル: gstGlut.c プロジェクト: MrVertinskis/smalltalk
int gst_glut_glutCreateWindow (const char *name)
{
  int id = glutCreateWindow (name);
  registerCallbacks ();
  return id;
}
コード例 #14
0
ファイル: gstGlut.c プロジェクト: MrVertinskis/smalltalk
int gst_glut_glutCreateSubWindow (int win, int x, int y, int width, int height)
{
  int id = glutCreateSubWindow (win, x, y, width, height);
  registerCallbacks ();
  return id;
}