Exemple #1
0
/*
 * Function
 *	TorcsEntry
 *
 * Description
 *	entry point of TORCS
 *
 * Parameters
 *	none
 *
 * Return
 *	none
 *
 * Remarks
 *	
 */
void
TorcsEntry(void)
{
	ssgInit();

	GfInitClient();

	TorcsMainMenuInit();

	SplashScreen();
	
	startMenuMusic();
}
int main(int argc, char **argv)
{
    init_args(argc, argv);
    glutInit(&argc, argv);
    glutCreateWindow(argv[1]);
    ssgInit();
    
#ifndef WIN32
    LinuxSpecInit();
#else
    WindowsSpecInit();
#endif

    Generate();
    return 0;
}
/** \brief Perform the basic scenegraph initialization
 *
 *  Initializes the PLIB SSG library, creates the scenegraph
 *  root, a rendering context and the sun.
 */
void initialize_scenegraph()
{
  // Initialize SSG
  ssgInit();
  
  // add to SSG function for read JPEG Textures 
  ::ssgAddTextureFormat ( ".jpg", ssgLoadJPG);
  
  // font
  puSetDefaultFonts ( FONT_HELVETICA_14, FONT_HELVETICA_14 );
  
  // Some basic OpenGL setup
  sgVec4 skycol;
  sgSetVec4 ( skycol, 0.0f, 0.0f, 0.0f, 1.0f ) ;
  glClearColor ( skycol[0], skycol[1], skycol[2], skycol[3] ) ;

  glEnable ( GL_DEPTH_TEST ) ;

  // Set up the viewing parameters
  context = new ssgContext();
  context->setFOV     ( 35.0f, 0 ) ;
  context->setNearFar ( 1.0f, 10000.0f ) ;
  context->makeCurrent();

  ssgModelPath("");
  ssgTexturePath("textures");  
  
  // Create a root node
  scene    = new ssgRoot();

  // Set up a light source
  sgVec4 lightamb;
  sgSetVec4(lightamb , 0.2f, 0.2f, 0.2f, 1.0f);
  ssgGetLight(0)->setPosition(lightposn);
  ssgGetLight(0)->setColour(GL_AMBIENT, lightamb);

  ssgGetLight(0)->setPosition(lightposn);


}
Exemple #4
0
void init_graphics ()
{
    int   fake_argc = 1 ;
    char *fake_argv[3] ;
    fake_argv[0] = "TexMapper" ;
    fake_argv[1] = "Texture Auto Mapper" ;
    fake_argv[2] = NULL ;

    /*
      Initialise GLUT
    */

    glutInitWindowPosition(0, 0);
    glutInitWindowSize(ImgSize, ImgSize);
    glutInit(&fake_argc, fake_argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow(fake_argv[1]);
 
    /* Callbacks */
    glutDisplayFunc(Display);
    
    /*
      Initialise SSG
    */
    ssgInit();

    /*
      Some basic OpenGL setup
    */
    glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
    glEnable(GL_DEPTH_TEST);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSwapBuffers();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSwapBuffers();

    load_database();

    glutMainLoop();
}