コード例 #1
0
//-----------------------------------------------------------------------------
// main
//-----------------------------------------------------------------------------
int main (int argc, char **argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
  glutInitWindowSize(1200, 800);
  glutCreateWindow("Dual Ray Implementation");
  glutDisplayFunc(display);	
  
  // Define base line		  
  s1_x[0] = 0.0; s1_y[0] = 0.0;
  s1_x[1] = 1.0; s1_y[1] = 0.0;
  // Define top line
  s2_x[0] = 0.0; s2_y[0] = 1.0;
  s2_x[1] = 1.0; s2_y[1] = 1.0;

  s_x[0] = 0.0; s_y[0] = 0.0;
  s_x[1] = 1.0; s_y[1] = 0.0;
  // Define top line
  s_x[2] = 0.0; s_y[2] = 1.0;
  s_x[3] = 1.0; s_y[3] = 1.0;
	
  //s_x[4] = 0.0; s_y[4] = -1.0;
  //s_x[5] = -1.0; s_y[5] = -1.0;

  s_x[4] = 0.0; s_y[4] = -1.0;
  s_x[5] = 1.0; s_y[5] = -1.0;	
  s_x[6] = 0.0; s_y[6] = 2.0;
  s_x[7] = 1.0; s_y[7] = 2.0;	
  s_x[8] = -1.0; s_y[8] = 1.0;
  s_x[9] = 2.0; s_y[9] = 1.0;
  s_x[10] = -1.0; s_y[10] = 0.0;
  s_x[11] = 2.0; s_y[11] = 0.0;

  // Define query line
  //v_x[0] = 0.5; v_y[0] = 0.5;
  //v_x[1] = 0.5; v_y[1] = 0.4;
  //v_x[0] = 0.0; v_y[0] = 0.2;
  //v_x[1] = 0.1; v_y[1] = 0.0;
  
  v_x[0] = 0.5; v_y[0] = 0.73;	
  v_x[1] = 0.30; v_y[1] = 0.1;	

  pointSel = true;
  displayV = false;
  for (int i=0; i<NLINES; i++) displayL[i] = true;

  setupRC();
  glutReshapeFunc(reshape);
  glutKeyboardFunc( keyboard );
  glutSpecialFunc( special );
  
  glutMainLoop();

  return 0;
}
コード例 #2
0
ファイル: atom.c プロジェクト: hiyjeain/opengl
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutCreateWindow("Atom!");
    glutReshapeFunc(onShapeChanged);
    glutDisplayFunc(onDraw);
    glutTimerFunc(500,handler, 1);
    setupRC();
    glutMainLoop();
    return 0;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: diunao/procesory
int main(int argc, char* argv[]) {
   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
   glutInitWindowSize(600, 600);
   glutCreateWindow("Rotating pyramid");
   glutReshapeFunc(changeSize);
   glutDisplayFunc(renderScene);
   GLenum err = glewInit();
   if(GLEW_OK != err) {
      return 1;
   }
   setupRC();
   glutMainLoop();
   return 0;
}
コード例 #4
0
int main( int argc, char **argv ) {
  glutInit( &argc, argv );

  glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
  glutInitWindowSize( 640, 480 );
  glutInitWindowPosition( 100, 100 );
  glutCreateWindow( argv[ 0 ] );
  glutDisplayFunc( renderScene );
  glutReshapeFunc( changeSize );
  glutSpecialFunc( specialKeys );
  glutKeyboardFunc( keyboard );
  glutMouseFunc( mouse );

  setupRC();

  glutMainLoop();
  return 0;
}
コード例 #5
0
int main(int argc, char** argv)
{
    try
      {
        // Create Razor AHRS object. Serial I/O will run in background thread and report
        // errors and data updates using the callbacks on_data() and on_error().
        // We want to receive yaw/pitch/roll data. If we wanted the unprocessed raw or calibrated sensor
        // data, we would pass RazorAHRS::ACC_MAG_GYR_RAW or RazorAHRS::ACC_MAG_GYR_CALIBRATED
        // instead of RazorAHRS::YAW_PITCH_ROLL.
        gRazor = new RazorAHRS(serial_port_name, on_data, on_error,
//                               RazorAHRS::YAW_PITCH_ROLL,
                               RazorAHRS::YAW_PITCH_ROLL,
                               5000, B57600);

       }
      catch(std::runtime_error &e)
      {
        LOGE("Could not create tracker: "<<e.what());
        LOGE("check your serial port");
        return 0;
      }

  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE|GLUT_ALPHA|GLUT_RGBA | GLUT_DEPTH);
  glutInitWindowSize(gWinWidth,gWinHeight);
  gWindowId = glutCreateWindow("Razor AHRS");
  GLenum err = glewInit();
  if (GLEW_OK != err)
  {
      // GLEW not supported
    LOGE("Error: "<< glewGetErrorString(err));
    exit(1);
  }
  glutKeyboardFunc(StdKeys);
  glutSpecialFunc(SpecialKeys);
  glutDisplayFunc(renderScene);
  glutReshapeFunc(changeSize);
  atexit(shutdownRC);

  setupRC();
  glutMainLoop();

  return 0;
}
コード例 #6
0
//--------------------------------------------------------------
void testApp::setup(){	
	ofBackground(0, 0, 0);
	ofSetVerticalSync(true);
	
	lightScatter.setup(ofGetWidth()/OFF_SCREEN_RENDER_RATIO, ofGetHeight()/OFF_SCREEN_RENDER_RATIO);
	fboLight.allocate(ofGetWidth(), ofGetHeight(), true);
	
	setupRC();
	
	/*
	dListA = glGenLists(1);
	glNewList(dListA,GL_COMPILE);
		glColor3ub(0, 0, 255);
		glutSolidSphere(30.0f, 50, 50);
	glEndList();
	
	dListB = glGenLists(1);
	glNewList(dListB,GL_COMPILE);
		glColor3ub(0, 0, 255);
		glutSolidSphere(20.0f, 50, 50);
	glEndList();
	*/
}
コード例 #7
0
ファイル: main.cpp プロジェクト: tailnode/chaos
int main(int argc, char* argv[])
{
    gltSetWorkingDirectory(argv[0]);

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH| GLUT_STENCIL);
    glutInitWindowSize(800, 600);
    glutCreateWindow("LearnTexture");
    glutReshapeFunc(changeSize);
    glutDisplayFunc(renderScene);
    glutSpecialFunc(keyFunc);

    GLenum err = glewInit();
    if (GLEW_OK != err) {
        fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
        return 1;
    }

    setupRC();
    glutMainLoop();
    cleanRC();
    return 0;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: Errim/Datorsalsplaneraren
int main(int argc, char* argv[])
{
	gltSetWorkingDirectory(argv[0]);

	//Initiate glut and create a window:
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE);
	glutInitWindowSize(W_WIDTH, W_HEIGHT);
	glutInitWindowPosition( (glutGet(GLUT_SCREEN_WIDTH)-W_WIDTH)/2, // Places the window in the middle of the screen
							(glutGet(GLUT_SCREEN_HEIGHT)-W_HEIGHT)/2);
	glutCreateWindow(W_TITLE);

	//Send funcs to gluttis:
	glutReshapeFunc(changeSize);
	glutDisplayFunc(renderScene);
	glutKeyboardUpFunc(releasedKeys);
	glutPassiveMotionFunc(mouseCameraFunc);
	glutMouseFunc(clickFunc);
	glutMotionFunc(mousePassiveFunc);

	GLenum result = glewInit();
	if(result != GLEW_OK)
	{
		fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(result));
		return 1;
	}
	
	//Setup stuff and start looping:
	setupRC();
	glutMainLoop();
	newDeskButton.clearTexture();
	removeDeskButton.clearTexture();
	exportButton.clearTexture();
	system("PAUSE");
	return 0;
}