Changeset 2931 in orxonox.OLD for orxonox/trunk/importer/framework.cc
- Timestamp:
- Nov 20, 2004, 1:33:51 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/importer/framework.cc
r2863 r2931 1 #include "windowHandler.h" // Include the Whandler Basecode 2 #include "object.h" 1 #include "framework.h" 3 2 4 3 int verbose = 1; 5 WindowHandler wHandler; // Create an instance of the whandler basecode class6 Object* obj;7 float rotator = 0.0;8 GLfloat whiteLight[] = {1.0, 1.0, 0.0,1.0};9 4 10 5 void DrawGLScene() 11 6 { 12 rotator +=.001;7 rotatorP += rotatorV; 13 8 14 9 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); … … 18 13 glLoadIdentity(); 19 14 gluPerspective(45.0f,500/375,0.1f,100.0f); 20 gluLookAt (5*sin(rotator),7.5,5*cos(rotator), 0,0,0, 0,1,0); 21 whiteLight[1] = .5+.5*sin(rotator*10); 22 whiteLight[2] = .5+.5*sin(rotator*10); 15 gluLookAt (5*sin(rotatorP),7.5,5*cos(rotatorP), 0,0,0, 0,1,0); 23 16 24 GLfloat lightPosition[] = {10.0*sin(rotator*10), 10, 19.0, 0.0};25 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);26 27 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);28 17 obj->draw(); 29 18 … … 53 42 obj = new Object(); 54 43 44 glEnable(GL_LIGHTING); 45 glEnable(GL_DEPTH_TEST); 46 47 GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0}; 48 GLfloat light0Position[] = {10.0, 10.0, 10.0, 0.0}; 49 GLfloat light1Position[] = {-10.0, -7.0, -6.0, 0.0}; 55 50 GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0}; 51 52 glEnable(GL_LIGHT0); 53 glLightfv(GL_LIGHT0, GL_POSITION, light0Position); 56 54 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 57 55 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight); 58 glEnable(GL_LIGHTING); 59 glEnable(GL_LIGHT0); 60 glEnable(GL_DEPTH_TEST); 61 56 57 glEnable(GL_LIGHT1); 58 glLightfv(GL_LIGHT1, GL_POSITION, light1Position); 59 glLightfv(GL_LIGHT1, GL_DIFFUSE, whiteLight); 60 glLightfv(GL_LIGHT1, GL_SPECULAR, whiteLight); 61 62 rotatorP = .0; 63 rotatorV = .0; 62 64 // Build the font from a TGA image font.tga in the data directory 63 65 // Hide the mouse cursor 64 SDL_ShowCursor(0);66 SDL_ShowCursor(2); 65 67 66 68 // This is the main loop for the entire program and it will run until done==TRUE … … 73 75 while ( SDL_PollEvent(&event) ) { 74 76 switch (event.type) { 77 case SDL_MOUSEMOTION: 78 if (verbose >=3) 79 printf("Mouse motion about %d,%d Pixels to (%d,%d).\n", 80 event.motion.xrel, event.motion.yrel, 81 event.motion.x, event.motion.y); 82 break; 83 case SDL_MOUSEBUTTONDOWN: 84 printf("MouseButton %d pressed at (%d,%d).\n", 85 event.button.button, event.button.x, event.button.y); 86 rotatorV = ( 250-event.button.x) / 500.0 /100; 87 88 break; 89 case SDL_MOUSEBUTTONUP: 90 printf("MouseButton %d released at (%d,%d).\n", 91 event.button.button, event.button.x, event.button.y); 92 93 94 break; 95 75 96 // If a quit event was recieved 76 97 case SDL_QUIT:
Note: See TracChangeset
for help on using the changeset viewer.