Changeset 3617 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Mar 21, 2005, 2:59:30 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r3611 r3617 30 30 { 31 31 this->setClassName ("GraphicsEngine"); 32 33 32 this->initVideo(); 33 34 this->listModes(); 35 34 36 35 37 } … … 60 62 int GraphicsEngine::initVideo() 61 63 { 62 64 // initialize SDL_VIDEO 63 65 if (SDL_Init(SDL_INIT_VIDEO) == -1) 64 66 { 65 printf("could not initialize SDL Video\n");67 PRINTF(1)("could not initialize SDL Video\n"); 66 68 // return -1; 67 69 } 70 // initialize SDL_GL-settings 71 this->setGLattribs(); 72 73 // setting the Video Flags. 74 this->videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE; 75 76 /* query SDL for information about our video hardware */ 77 const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo (); 78 if( videoInfo == NULL) 79 { 80 PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError()); 81 SDL_Quit (); 82 } 83 if( videoInfo->hw_available) 84 this->videoFlags |= SDL_HWSURFACE; 85 else 86 this->videoFlags |= SDL_SWSURFACE; 87 /* 88 if(VideoInfo -> blit_hw) 89 VideoFlags |= SDL_HWACCEL; 90 */ 91 92 // setting up the Resolution 93 this->setResoulution(800, 600, 16); 94 95 // Set window labeling 96 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 97 98 // TO DO: Create a cool icon and use it here 99 // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 100 101 } 102 103 104 int GraphicsEngine::setGLattribs(void) 105 { 68 106 // Set video mode 69 107 // TO DO: parse arguments for settings … … 81 119 SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0); 82 120 SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0); 83 84 85 //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/86 //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;87 88 this->videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;89 90 /* query SDL for information about our video hardware */91 const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();92 93 if( videoInfo == NULL)94 {95 PRINTF(1)("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());96 SDL_Quit ();97 }98 if( videoInfo->hw_available)99 this->videoFlags |= SDL_HWSURFACE;100 else101 this->videoFlags |= SDL_SWSURFACE;102 /*103 if(VideoInfo -> blit_hw)104 VideoFlags |= SDL_HWACCEL;105 */106 107 this->setResoulution(800, 600, 16);108 109 // Set window labeling110 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);111 112 // TO DO: Create a cool icon and use it here113 // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);114 115 121 } 116 122 … … 129 135 130 136 } 137 138 139 140 141 142 143 144 /** 145 \brief outputs all the Fullscreen modes. 146 */ 147 void GraphicsEngine::listModes(void) 148 { 149 /* Get available fullscreen/hardware modes */ 150 this->videoModes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); 151 152 /* Check is there are any modes available */ 153 if(this->videoModes == (SDL_Rect **)0){ 154 PRINTF(1)("No modes available!\n"); 155 exit(-1); 156 } 157 158 /* Check if our resolution is restricted */ 159 if(this->videoModes == (SDL_Rect **)-1){ 160 PRINTF(1)("All resolutions available.\n"); 161 } 162 else{ 163 /* Print valid modes */ 164 PRINT(0)("Available Resoulution Modes are\n"); 165 for(int i = 0; this->videoModes[i]; ++i) 166 PRINT(0)(" | %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h); 167 } 168 169 } -
orxonox/trunk/src/lib/graphics/graphics_engine.h
r3611 r3617 24 24 25 25 int initVideo(); 26 int setGLattribs(void); 26 27 int setResoulution(int width, int height, int bpp); 28 void listModes(void); 27 29 28 30 static bool texturesEnabled; … … 39 41 bool fullscreen; 40 42 Uint32 videoFlags; 43 44 SDL_Rect **videoModes; 41 45 }; 42 46
Note: See TracChangeset
for help on using the changeset viewer.