示例#1
0
文件: ex35.c 项目: jchan1e/graphics
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering & stencil at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_STENCIL);
   glutInitWindowSize(600,600);
   glutCreateWindow("Shadow Volumes");
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(move?idle:NULL);
   //  Check stencil depth
   glGetIntegerv(GL_STENCIL_BITS,&depth);
   if (depth<=0) Fatal("No stencil buffer\n");
   //  Load textures
   tex2d[0] = LoadTexBMP("water.bmp");
   tex2d[1] = LoadTexBMP("crate.bmp");
   tex2d[2] = LoadTexBMP("pi.bmp");
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
int main(int argc,char* argv[])
{
   //  Initialize GLUT and process user parameters
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitWindowSize(600,600);
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   //  Create the window
   glutCreateWindow("Objects");
   //  Tell GLUT to call "idle" when there is nothing else to do
   glutIdleFunc(idle);
   //  Tell GLUT to call "display" when the scene should be drawn
   glutDisplayFunc(display);
   //  Tell GLUT to call "reshape" when the window is resized
   glutReshapeFunc(reshape);
   //  Tell GLUT to call "special" when an arrow key is pressed
   glutSpecialFunc(special);
   //  Tell GLUT to call "key" when a key is pressed
   glutKeyboardFunc(key);

   texture[0] = LoadTexBMP("znorl.bmp");
   texture[1] = LoadTexBMP("metal.bmp");
   texture[2] = LoadTexBMP("turquoise.bmp");
   texture[3] = LoadTexBMP("stripemetal.bmp");
   //  Pass control to GLUT so it can interact with the user
   glutMainLoop();
   return 0;
}
示例#3
0
  /*
  *  Start up GLUT and tell it what to do
  */
  int main(int argc,char* argv[])
  {
    //  Initialize GLUT
    glutInit(&argc,argv);
    //  Request double buffered, true color window with Z buffering at 600x600
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    glutInitWindowSize(window_width,window_height);
    glutCreateWindow("Samuel Volin");

    glutIdleFunc(idlefunc);
    //  Set callbacks
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutSpecialFunc(special);
    glutMouseFunc(mouse);
    glutMotionFunc(motionmouse);
    glutKeyboardFunc(key);
    // load textures
    floor_texture = LoadTexBMP("floor.bmp");
    arrow_texture = LoadTexBMP("arrows.bmp");
    mural_texture[0] = LoadTexBMP("1.bmp");
    mural_texture[1] = LoadTexBMP("2.bmp");
    mural_texture[2] = LoadTexBMP("3.bmp");
    mural_texture[3] = LoadTexBMP("4.bmp");
    wall_texture = LoadTexBMP("wall.bmp");
    ball_texture = LoadTexBMP("ball.bmp");
    cieling_texture = LoadTexBMP("cieling.bmp");
    duct_texture = LoadTexBMP("duct.bmp");
    glutMainLoop();
    return 0;
  }
示例#4
0
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   int k;

   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_ALPHA);
   glutCreateWindow("Solar System");
   glutFullScreen();
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   //  Load textures
   for (k=0;k<N;k++)
   {
      planet[k].balltex = LoadTexBMP(planet[k].ball);
      planet[k].ringtex = planet[k].ring ? LoadTexBMP(planet[k].ring) : 0;
   }
   SetMode(3);

   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
示例#5
0
void setup_textures ()
{
	v_textures[0] = LoadTexBMP("textures/floor_tiles.bmp");
	v_textures[1] = LoadTexBMP("textures/wall.bmp");
	v_textures[2] = LoadTexBMP("textures/ceiling.bmp");
	v_textures[3] = LoadTexBMP("textures/door.bmp");
	printf("Texture Loaded: %u", v_textures[0]);
}
示例#6
0
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
	//  Initialize GLUT
	glutInit(&argc,argv);
	//  Request double buffered, true color window with Z buffering at 600x600
	glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
	glutInitWindowSize(700,700);
	glutCreateWindow("Robert Werthman Assignment 6");
	//  Set callbacks
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutSpecialFunc(special);
	glutKeyboardFunc(key);
	//  Tell GLUT to call "idle" when there is nothing else to do
	glutIdleFunc(idle);

	// Load the textures for the helicopter
	littlebird[0] = LoadTexBMP("littlebirdenginetank.bmp");
	littlebird[1] = LoadTexBMP("littlebirdenginetank.bmp");
	littlebird[2] = LoadTexBMP("littlebirdcockpit.bmp");
	littlebird[3] = LoadTexBMP("littlebirdengine.bmp");
	littlebird[4] = LoadTexBMP("littlebirdskidmount.bmp");
	littlebird[5] = LoadTexBMP("littlebirdskid.bmp");
	littlebird[6] = LoadTexBMP("littlebirdrotor.bmp");
	littlebird[7] = LoadTexBMP("littlebirdgear.bmp");

	//  Check if any errors have occurred
	ErrCheck("init");
	//  Pass control to GLUT so it can interact with the user
	glutMainLoop();
	return 0;
}
示例#7
0
文件: ex06.c 项目: jchan1e/graphics
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   glutInitWindowSize(600,600);
   glutCreateWindow("OpenGL 4");
#ifdef USEGLEW
   //  Initialize GLEW
   if (glewInit()!=GLEW_OK) Fatal("Error initializing GLEW\n");
   if (!GLEW_VERSION_4_3) Fatal("OpenGL 4.3 not supported\n");
#endif
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   //  Load crate
   crate = LoadTexBMP("pi.bmp");
   //  Create Shader Programs
   shader = CreateShaderProg("gl430.vert","gl430.frag");
   //  Initialize cube
   InitCube();
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
示例#8
0
//
//  Load materials from file
//
static void LoadMaterial(const char* file)
{
   int k=-1;
   char* line;
   char* str;

   //  Open file or return with warning on error
   FILE* f = fopen(file,"r");
   if (!f)
   {
      fprintf(stderr,"Cannot open material file %s\n",file);
      return;
   }

   //  Read lines
   while ((line = readline(f)))
   {
      //  New material
      if ((str = readstr(line,"newmtl")))
      {
         int l = strlen(str);
         //  Allocate memory for structure
         k = Nmtl++;
         mtl = (mtl_t*)realloc(mtl,Nmtl*sizeof(mtl_t));
         //  Store name
         mtl[k].name = (char*)malloc(l+1);
         if (!mtl[k].name) Fatal("Cannot allocate %d for name\n",l+1);
         strcpy(mtl[k].name,str);
         //  Initialize materials
         mtl[k].Ka[0] = mtl[k].Ka[1] = mtl[k].Ka[2] = 0;   mtl[k].Ka[3] = 1;
         mtl[k].Kd[0] = mtl[k].Kd[1] = mtl[k].Kd[2] = 0;   mtl[k].Kd[3] = 1;
         mtl[k].Ks[0] = mtl[k].Ks[1] = mtl[k].Ks[2] = 0;   mtl[k].Ks[3] = 1;
         mtl[k].Ns  = 0;
         mtl[k].d   = 0;
         mtl[k].map = 0;
      }
      //  If no material short circuit here
      else if (k<0)
      {}
      //  Ambient color
      else if (line[0]=='K' && line[1]=='a')
         readfloat(line+2,3,mtl[k].Ka);
      //  Diffuse color
      else if (line[0]=='K' && line[1] == 'd')
         readfloat(line+2,3,mtl[k].Kd);
      //  Specular color
      else if (line[0]=='K' && line[1] == 's')
         readfloat(line+2,3,mtl[k].Ks);
      //  Material Shininess
      else if (line[0]=='N' && line[1]=='s')
         readfloat(line+2,1,&mtl[k].Ns);
      //  Textures (must be BMP - will fail if not)
      else if ((str = readstr(line,"map_Kd"))){
          mtl[k].map = LoadTexBMP(str);
      }
       
      //  Ignore line if we get here
   }
   fclose(f);
}
示例#9
0
文件: ex26.cpp 项目: jchan1e/graphics
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
   glutInitWindowSize(600,600);
   glutCreateWindow("Nbody Simulator");
#ifdef USEGLEW
   //  Initialize GLEW
   if (glewInit()!=GLEW_OK) Fatal("Error initializing GLEW\n");
   if (!GLEW_VERSION_2_0) Fatal("OpenGL 2.0 not supported\n");
#endif
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   //  Initialize stars
   InitLoc();
   //  Initialize OpenCL
   InitCL();
   //  Shader program
   shader = CreateShaderProgGeom();
   ErrCheck("init");
   //  Star texture
   LoadTexBMP("star.bmp");
   //  Pass control to GLUT so it can interact with the user
   glutMainLoop();
   return 0;
}
示例#10
0
int main(int argc, char **argv)
{
    // We use the GLUT utility to initialize the window, to handle the input and to interact with the windows system
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(screen_width,screen_height);
    glutInitWindowPosition(0,0);
    glutCreateWindow("SpaceJump");
    glutFullScreen();
    glutDisplayFunc(display);
    glutReshapeFunc (resize);
    glutKeyboardFunc (keyboard);
    glutSpecialFunc (keyboard_s);
    mover(1);
    sky[0] = LoadTexBMP("planetcropped_scaled_trans.bmp");
    texture[0] = LoadTexBMP("floor2.bmp");
    texture[1] = LoadTexBMP("over.bmp");
    texture[2] = LoadTexBMP("spacejump_start.bmp");
    texture[3] = LoadTexBMP("brickwall.bmp");

    //  Initialize audio
    if (Mix_OpenAudio(44100,AUDIO_S16SYS,2,4096)) Fatal("Cannot initialize audio\n");

    blt = Mix_LoadMUS("bullet.ogg");

    if (!blt) Fatal("Cannot load bullet.ogg\n");

    eng = Mix_LoadMUS("engine.ogg");

    if (!eng) Fatal("Cannot load engine.ogg\n");

    blast = Mix_LoadMUS("explosion.ogg");

    if (!blast) Fatal("Cannot load explosion.ogg\n");

    Init_star();
    init();


    width =  glutGet(GLUT_WINDOW_WIDTH);
    height = glutGet(GLUT_WINDOW_HEIGHT);

    glutMainLoop();

    return(0);
}
示例#11
0
int main(int argc, char* argv[]){
	//Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   glutInitWindowSize(600,600);
   glutCreateWindow("Textures and Lighting");

      //  Set callbacks
	init();
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   
   //process mouse callbacks
	glutMouseFunc(picker);
	//glutMotionFunc(processMouseActiveMotion);
	///glutPassiveMotionFunc(processMousePassiveMotion);
//	glutEntryFunc(processMouseEntry);
   
   
   //  Load textures
   texture[0] = LoadTexBMP("crate.bmp");
   texture[1] = LoadTexBMP("StoneWall.bmp");
   texture[2] = LoadTexBMP("grass.bmp");
   texture[3] = LoadTexBMP("bark.bmp");
   texture[4] = LoadTexBMP("roof.bmp");
   texture[5] = LoadTexBMP("brick.bmp");
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
示例#12
0
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   glutInitWindowSize(600,600);
   glutCreateWindow("Taylor Andrews");
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   //Load Textures
   texture[0] = LoadTexBMP("coke.bmp");
   texture[1] = LoadTexBMP("top.bmp");
   texture[2] = LoadTexBMP("bottom.bmp");
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
示例#13
0
文件: textures.c 项目: untra/textures
  /*
  *  Start up GLUT and tell it what to do
  */
  int main(int argc,char* argv[])
  {
    //  Initialize GLUT
    glutInit(&argc,argv);
    //  Request double buffered, true color window with Z buffering at 600x600
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    glutInitWindowSize(window_width,window_height);
    glutCreateWindow("Samuel Volin");

    glutIdleFunc(idlefunc);
    //  Set callbacks
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutSpecialFunc(special);
    glutMouseFunc(mouse);
    glutMotionFunc(motionmouse);
    glutKeyboardFunc(key);
    // load textures
    end = LoadTexBMP("end.bmp");
    side = LoadTexBMP("side.bmp");
    //  Pass control to GLUT so it can interact with the user
    glutMainLoop();
    return 0;
  }
示例#14
0
文件: pacman.c 项目: denzelr/Pacman
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   glutInitWindowSize(800,800);
   glutCreateWindow("Pacman: Ryan Denzel");
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutKeyboardFunc(key);
   // Load Texture
   texture[0] = LoadTexBMP("brick.bmp");
   //  Pass control to GLUT so it can interact with the user
   glutMainLoop();
   return 0;
}
示例#15
0
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   glutInitWindowSize(800,800);
   glutCreateWindow("Vahid Mazdeh - hw3 - Egyptian Pyramids w Lighting + Texture");
   // background color
   glClearColor(0.95, 0.810, 0.4, 0.0);
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   LoadTexBMP("textures/pyramid.bmp");
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
示例#16
0
GLuint Texture::loadTexture(std::string source, std::string key){
    GLuint newTex = LoadTexBMP(source.c_str());
    textureMap[key] = newTex;
    std::cout << "Loaded texture '" << key << "' as texture " << newTex << std::endl;
    return newTex;
}
void XmlParser::loadFromXml(const char * fileName, int * argc, char ** argv) {
    XmlFile xmlFile(fileName);
    XmlDocument doc;
    doc.parse<0>(xmlFile.data());
    int W, H;

    XmlNode * rtNode = doc.first_node("ge");

    /*** Read window information ***/
    XmlNode * windowNode = rtNode->first_node("window");
    if (windowNode) {
        // Try to read window name
        XmlNode * name;
        xmlElement(name, windowNode);

        // Read width and height
        XmlNode * width, *height;
        xmlElement(width, windowNode);
        xmlElement(height, windowNode);

        W = atoi(width->value());
        H = atoi(height->value());

        // Set window parameters
        GameWindow::setWindow((name) ? name->value() : "GE", W, H);
    } else {
        W = 512;
        H = 512;

        GameWindow::setWindow("GE", W, H);
    }
    // Init gamewindow and light
    GameWindow::init(argc, argv);
    Light::init();
    Material::init();
    Input::init();
    GBuffer::init(W,H);
    // Load noise texture
    glActiveTexture(GL_TEXTURE11);
    LoadTexBMP("textures/noise.bmp");
    /*** Read Scene ***/
    // Reference to scene node
    XmlNode * sceneNode = rtNode->first_node("scene");
    // Instantiate scene    
    Scene * scene = new Scene();
    // Instantiate renderer
    Renderer * renderer = new Renderer();
    // Set renderer
    GameWindow::setRenderer(renderer);
    renderer->setScene(scene);

	// Create camera
	Camera * camera = new Camera();
	// Set camera
	renderer->setCamera(camera);
	camera->setAspectRatio(W/H);

	// Read Camera
	XmlNode * cameraNode = rtNode->first_node("camera");
	if (cameraNode) {
		readModel(camera, cameraNode->first_node("model"));
//		// Set position
//		XmlNode * position = cameraNode->first_node("position");
//		if (position) {
//			// Get coordinates
//			XmlAttr * x, *y, *z;
//			xmlAttribute(x, position);
//			xmlAttribute(y, position);
//			xmlAttribute(z, position);
//			camera->setPosition(atof(x->value()), atof(y->value()), atof(z->value()));
//		}
//
//		// Set direction
//		XmlNode * direction= cameraNode->first_node("direction");
//		if (direction) {
//			// Get coordinates
//			XmlAttr * x, *y, *z;
//			xmlAttribute(x, direction);
//			xmlAttribute(y, direction);
//			xmlAttribute(z, direction);
//			camera->setDirection(atof(x->value()), atof(y->value()),
//					atof(z->value()));
//		}
//
//
//		// Set direction
//		XmlNode * up = cameraNode->first_node("up");
//		if (up) {
//			// Get coordinates
//			XmlAttr * x, *y, *z;
//			xmlAttribute(x, up);
//			xmlAttribute(y, up);
//			xmlAttribute(z, up);
//			camera->setUp(atof(x->value()), atof(y->value()),
//					atof(z->value()));
//		}

		// Read scripts
		XmlNode * scriptsNode = cameraNode->first_node("scripts");
		readScripts(scene, camera, scriptsNode);
	}

    // Light shadow map must be initialized after renderer has a camera
    Light::initShadowMap(renderer->createShaderProg("shaders/shadow.vert", "shaders/shadow.frag"));

    // Read objects
    XmlNode * objectsNode = sceneNode->first_node("objects");
    if (objectsNode) {
        // Read all cubes
        XmlNode * cubeNode = objectsNode->first_node("cube");
        readCubes(renderer, scene, cubeNode);

        // Read all mesh from scene
        XmlNode * meshNode = objectsNode->first_node("mesh");
        readMeshs(renderer, scene, meshNode);
        
    } else {
        printf("No objects\n");
    }

    // Read Lights
    XmlNode * lights = sceneNode->first_node("lights");
    readLights(scene, lights);
}
/* ---------------------------------------------------------------------------- */
int main(int argc, char **argv)
{
    struct aiLogStream stream;
    glutInitWindowSize(900,600);
    glutInitWindowPosition(100,100);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutInit(&argc, argv);
    glutCreateWindow("Michael Eller - Final Project (Preview)");
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutSetCursor(GLUT_CURSOR_NONE);
    glutKeyboardFunc(key);
    sky[0] = LoadTexBMP("../sky0.bmp");
    sky[1] = LoadTexBMP("../sky1.bmp");
    printf("FLT_MAX = %f\n",FLT_MAX);
    /* get a handle to the predefined STDOUT log stream and attach
       it to the logging system. It remains active for all further
       calls to aiImportFile(Ex) and aiApplyPostProcessing. */
    stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
    aiAttachLogStream(&stream);

    /* ... same procedure, but this stream now writes the
       log messages to assimp_log.txt */
    stream = aiGetPredefinedLogStream(aiDefaultLogStream_FILE,"assimp_log.txt");
    aiAttachLogStream(&stream);

    loadasset(Xwing);
    glClearColor(0.1f,0.1f,0.1f,1.f);

    glutMouseFunc(MouseButton);
    glutMotionFunc(MouseMotion);


    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);    /* Uses default lighting parameters */
    glEnable(GL_LIGHT1);    /* Light corresponding to star in skybox */
    glEnable(GL_DEPTH_TEST);

    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
    glEnable(GL_NORMALIZE);
    glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
    /* XXX docs say all polygons are emitted CCW, but tests show that some aren't. */
    if(getenv("MODEL_IS_BROKEN"))  
        glFrontFace(GL_CW);

    glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);

    glutGet(GLUT_ELAPSED_TIME);
    glutMainLoop();

    /* cleanup - calling 'aiReleaseImport' is important, as the library 
       keeps internal resources until the scene is freed again. Not 
       doing so can cause severe resource leaking. */
    aiReleaseImport(scene);

    /* We added a log stream to the library, it's our job to disable it
       again. This will definitely release the last resources allocated
       by Assimp.*/
    aiDetachAllLogStreams();
    return 0;
}
示例#19
0
/*
 *  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   int n;
   //  Initialize GLUT
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   glutInitWindowSize(600,600);
   glutCreateWindow("Stored Textures");
#ifdef USEGLEW
   //  Initialize GLEW
   if (glewInit()!=GLEW_OK) Fatal("Error initializing GLEW\n");
   if (!GLEW_VERSION_2_0) Fatal("OpenGL 2.0 not supported\n");
#endif
   //  Set callbacks
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutSpecialFunc(special);
   glutKeyboardFunc(key);
   glutIdleFunc(idle);
   //  Make sure enough texture units are available
   glGetIntegerv(GL_MAX_TEXTURE_UNITS,&n);
   if (n<4) Fatal("Insufficient texture Units %d\n",n);
   //  Allocate quadric for ball
   ball = gluNewQuadric();
   //  Load daytime textures
   day[0]  = LoadTexBMP("day01.bmp");
   day[1]  = LoadTexBMP("day02.bmp");
   day[2]  = LoadTexBMP("day03.bmp");
   day[3]  = LoadTexBMP("day04.bmp");
   day[4]  = LoadTexBMP("day05.bmp");
   day[5]  = LoadTexBMP("day06.bmp");
   day[6]  = LoadTexBMP("day07.bmp");
   day[7]  = LoadTexBMP("day08.bmp");
   day[8]  = LoadTexBMP("day09.bmp");
   day[9]  = LoadTexBMP("day10.bmp");
   day[10] = LoadTexBMP("day11.bmp");
   day[11] = LoadTexBMP("day12.bmp");
   //  Load nightime texture
   glActiveTexture(GL_TEXTURE2);
   night = LoadTexBMP("night.bmp");
   //  Load cloud & gloss texture
   glActiveTexture(GL_TEXTURE3);
   cloudgloss = LoadTexBMP("cloudgloss.bmp");
   //  Create shader programs
   shader = CreateShaderProg("earth.vert","earth.frag");
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glutMainLoop();
   return 0;
}
示例#20
0
//used to load textures into variables
void loadTextures()
{
    //load textures
    //wall texture for arches.
    outsideArchTextures[0] = LoadTexBMP("textures/wallTexture.bmp");
    //roof texture for arches.
    outsideArchTextures[1] = LoadTexBMP("textures/roofTexture.bmp");
    insideArchTextures[0] = outsideArchTextures[0];
    insideArchTextures[1] = LoadTexBMP("textures/cathedralCeiling.bmp");
    //texture for ground
    groundTexture = LoadTexBMP("textures/groundTexture.bmp");
    //texture for skybox
    skyTextures[0] = LoadTexBMP("textures/skyTop.bmp");
    skyTextures[1] = LoadTexBMP("textures/skySide.bmp");
    altarTexture = LoadTexBMP("textures/marbleTexture.bmp");
    woodTexture = LoadTexBMP("textures/woodTexture.bmp");
    stainedGlassTexture = LoadTexBMP("textures/stainedGlassTexture.bmp");
    stainedGlassTexture2 = LoadTexBMP("textures/stainedGlassTexture2.bmp");
    tileTexture = LoadTexBMP("textures/tileTexture.bmp");
}
 /*  Start up GLUT and tell it what to do
 */
int main(int argc,char* argv[])
{
   //  Initialize GLUT and process user parameters
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitWindowSize(600,600);
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   //  Create the window
   glutCreateWindow("Car Game Simulation");
   //  Tell GLUT to call "display" when the scene should be drawn
   glutDisplayFunc(display);
   //  Tell GLUT to call "reshape" when the window is resized
   glutReshapeFunc(reshape);
   //  Tell GLUT to call "special" when an arrow key is pressed
   glutSpecialFunc(special);
   //  Tell GLUT to call "key" when a key is pressed
   glutKeyboardFunc(key);
   //  Tell GLUT to call idle function
   glutIdleFunc(idle);
    glutTimerFunc(3000,timerFunction,0);

    //  Load textures
   texture[0] = LoadTexBMP("checks.bmp");
   texture[1] = LoadTexBMP("redmetal.bmp");
   texture[2]=LoadTexBMP("lamp.bmp");
   texture[3]=LoadTexBMP("flower.bmp");
   texture[4]=LoadTexBMP("bark.bmp");
   texture[6]=LoadTexBMP("bestcar.bmp");
   texture[7]=LoadTexBMP("cars.bmp");
   sky[0]=LoadTexBMP("crosswalk.bmp");
   sky[1]=LoadTexBMP("building.bmp");
   sky[2]=LoadTexBMP("panorama_360.bmp");
   sky[3]=LoadTexBMP("roadpylon.bmp");
   sky[4]=LoadTexBMP("clouds2.bmp");
   sky[5]=LoadTexBMP("sign.bmp");
   sky[6]=LoadTexBMP("land0.bmp");
  
   car1=LoadOBJ("sls_amg.obj");   
   car2=LoadOBJ("california.obj");
   dragon=LoadOBJ("dragon.obj");
   //  Pass control to GLUT so it can interact with the user
   ErrCheck("init");
   glEnable(GL_DEPTH_TEST);
   glutMainLoop();
   return 0;
}
示例#22
0
int main(int argc,char* argv[])
{
   //  Initialize GLUT and process user parameters
   glutInit(&argc,argv);
   //  Request double buffered, true color window with Z buffering at 600x600
   glutInitWindowSize(800,800);
   glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   //  Create the window
   glutCreateWindow("Objects");
   //  Tell GLUT to call "idle" when there is nothing else to do
   glutIdleFunc(idle);
   //  Tell GLUT to call "display" when the scene should be drawn
   glutDisplayFunc(display);
   //  Tell GLUT to call "reshape" when the window is resized
   glutReshapeFunc(reshape);
   //  Tell GLUT to call "special" when an arrow key is pressed
   glutSpecialFunc(special);
   //  Tell GLUT to call "key" when a key is pressed
   glutKeyboardFunc(key);


   // Load Textures
   texture[0] = LoadTexBMP("znorl.bmp");
   texture[1] = LoadTexBMP("metal.bmp");
   texture[2] = LoadTexBMP("turquoise.bmp");
   texture[3] = LoadTexBMP("stars.bmp");
   texture[4] = LoadTexBMP("particle.bmp");
   texture[5] = LoadTexBMP("zekador.bmp");
   texture[6] = LoadTexBMP("ishthar.bmp");
   texture[7] = LoadTexBMP("nesk.bmp");
   texture[8] = LoadTexBMP("centura.bmp");
   texture[9] = LoadTexBMP("tenav.bmp");
   texture[10] = LoadTexBMP("tsarvia.bmp");
   texture[11] = LoadTexBMP("kolatanevat.bmp");
   texture[12] = LoadTexBMP("falarn.bmp");
   texture[13] = LoadTexBMP("grass.bmp");
   texture[14] = LoadTexBMP("wood.bmp");
   texture[15] = LoadTexBMP("pine.bmp");
   texture[16] = LoadTexBMP("water.bmp");
   texture[17] = LoadTexBMP("blue.bmp");
   texture[18] = LoadTexBMP("red.bmp");
   texture[19] = LoadTexBMP("darkmetal.bmp");

   // Load Maya objects
   //int num_vertices, int num_normals, int num_tex, int num_faces, char *filename
   // double *vertices, double *normals, double *texs, int *faces
   load_obj(num_vertices_voyager, num_normals_voyager, num_tex_voyager, num_faces_voyager, "voyagereng.obj", voyager_vertices, voyager_normals, voyager_texs, voyager_faces);
   load_obj(num_vertices_asteroid, num_normals_asteroid, num_tex_asteroid, num_faces_asteroid, "asteroid1.obj", asteroid_1_vertices, asteroid_1_normals, asteroid_1_texs, asteroid_1_faces);
   load_obj(num_vertices_asteroid, num_normals_asteroid, num_tex_asteroid, num_faces_asteroid, "asteroid2.obj", asteroid_2_vertices, asteroid_2_normals, asteroid_2_texs, asteroid_2_faces);
   load_obj(num_vertices_asteroid, num_normals_asteroid, num_tex_asteroid, num_faces_asteroid, "asteroid3.obj", asteroid_3_vertices, asteroid_3_normals, asteroid_3_texs, asteroid_3_faces);
   load_obj(num_vertices_asteroid, num_normals_asteroid, num_tex_asteroid, num_faces_asteroid, "asteroid_city.obj", asteroid_city_vertices, asteroid_city_normals, asteroid_city_texs, asteroid_city_faces);
   load_obj(num_vertices_city, num_normals_city, num_tex_city, num_faces_city, "city.obj", city_vertices, city_normals, city_texs, city_faces);
   load_obj(num_vertices_renegade, num_normals_renegade, num_tex_renegade, num_faces_renegade, "renegade.obj", renegade_vertices, renegade_normals, renegade_texs, renegade_faces);
   load_obj(num_vertices_phantom, num_normals_phantom, num_tex_phantom, num_faces_phantom, "phantom.obj", phantom_vertices, phantom_normals, phantom_texs, phantom_faces);




   init_particles(sun_particle, MAX_SUN_PARTICLES, 0.01, 10, 10, 1, 1, 0, 1.0, 0);
   init_particles(ship_particle, MAX_SHIP_PARTICLES, 0.01, 10, 10, 1, 1, 1, 1.0, 10);
   //  Pass control to GLUT so it can interact with the user
   glutMainLoop();
   return 0;
}