Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3365 in orxonox.OLD for orxonox/trunk/src/orxonox.cc


Ignore:
Timestamp:
Jan 7, 2005, 1:14:33 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/parenting back to the.
merged with command:
svn merge branches/parenting trunk -r 3247:HEAD
resolved all conflicts in favor of parenting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/orxonox.cc

    r3226 r3365  
    115115  // Set video mode
    116116  // TO DO: parse arguments for settings
    117   SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
    118   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
    119   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
    120   SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    121  
     117  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
     118  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
     119  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
     120  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
     121 
     122
     123  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
     124  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
     125  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
     126  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
     127  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
     128  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
     129  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
     130
     131
     132
    122133  int bpp = 16;
    123134  int width = 640;
    124135  int height = 480;
    125   Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
    126  
    127   if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL)
     136  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
     137  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
     138
     139  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
     140
     141  /* query SDL for information about our video hardware */
     142  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
     143 
     144  if( videoInfo == NULL)
     145    {
     146      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());
     147      SDL_Quit ();
     148    }
     149  if( videoInfo->hw_available)
     150    videoFlags |= SDL_HWSURFACE;
     151  else
     152    videoFlags |= SDL_SWSURFACE;
     153  /*
     154  if(VideoInfo -> blit_hw)                           
     155    VideoFlags |= SDL_HWACCEL;
     156  */
     157 
     158  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
    128159  {
    129     printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());
     160    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
    130161    SDL_Quit();
    131162    return -1;
     
    133164 
    134165  // Set window labeling
    135   SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
     166  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    136167 
    137168  // TO DO: Create a cool icon and use it here
     
    139170
    140171  // OpenGL stuff
    141   // (Is this all we initialize globally???)
    142   glClearColor(0.0, 0.0, 0.0, 0.0);
    143   glEnable(GL_DEPTH_TEST);
     172  glClearColor (0.0, 0.0, 0.0, 0.0);
     173  glEnable (GL_DEPTH_TEST);
    144174 
    145175  // LIGHTING
     
    148178  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
    149179
    150   glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
    151   glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
    152   glEnable(GL_LIGHTING);
    153   glEnable(GL_LIGHT0);
    154   glEnable(GL_DEPTH_TEST);
    155   glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
    156   glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
     180  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
     181  glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight);
     182  glEnable (GL_LIGHTING);
     183  glEnable (GL_LIGHT0);
     184  glEnable (GL_DEPTH_TEST);
     185  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
     186  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
    157187   
     188  //glEnable (GL_TEXTURE_2D);
    158189  //  glEnable(GL_COLOR);
    159190  //  glShadeModel(GL_SMOOTH);
     
    311342
    312343
     344SDL_Surface* Orxonox::getScreen ()
     345{
     346  return this->screen;
     347}
    313348
    314349
Note: See TracChangeset for help on using the changeset viewer.