Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3399 in orxonox.OLD for orxonox/branches/nico/src/orxonox.cc


Ignore:
Timestamp:
Feb 6, 2005, 11:27:25 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/nico: merged trunk into branches/nico
merged with command:
svn merge ../trunk/ nico/ -r 3238:HEAD
resolved conflict in favor of branches/nico.

Location:
orxonox/branches/nico
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico

    • Property svn:externals set to
  • orxonox/branches/nico/src/orxonox.cc

    r3238 r3399  
    3131#include "game_loader.h"
    3232#include <string.h>
     33int verbose;
    3334
    3435using namespace std;
     
    115116  // Set video mode
    116117  // 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  
     118  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
     119  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
     120  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
     121  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
     122 
     123
     124  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
     125  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
     126  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
     127  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
     128  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
     129  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
     130  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
     131
     132
     133
    122134  int bpp = 16;
    123135  int width = 640;
    124136  int height = 480;
    125   Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
    126  
    127   if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL)
     137  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
     138  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
     139
     140  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
     141
     142  /* query SDL for information about our video hardware */
     143  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
     144 
     145  if( videoInfo == NULL)
     146    {
     147      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());
     148      SDL_Quit ();
     149    }
     150  if( videoInfo->hw_available)
     151    videoFlags |= SDL_HWSURFACE;
     152  else
     153    videoFlags |= SDL_SWSURFACE;
     154  /*
     155  if(VideoInfo -> blit_hw)                           
     156    VideoFlags |= SDL_HWACCEL;
     157  */
     158 
     159  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
    128160  {
    129     printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());
     161    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
    130162    SDL_Quit();
    131163    return -1;
     
    133165 
    134166  // Set window labeling
    135   SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
     167  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    136168 
    137169  // TO DO: Create a cool icon and use it here
     
    139171
    140172  // OpenGL stuff
    141   // (Is this all we initialize globally???)
    142   glClearColor(0.0, 0.0, 0.0, 0.0);
    143   glEnable(GL_DEPTH_TEST);
     173  glClearColor (0.0, 0.0, 0.0, 0.0);
     174  glEnable (GL_DEPTH_TEST);
    144175 
    145176  // LIGHTING
     
    148179  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
    149180
    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);
     181  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
     182  glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight);
     183  glEnable (GL_LIGHTING);
     184  glEnable (GL_LIGHT0);
     185  glEnable (GL_DEPTH_TEST);
     186  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
     187  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
    157188   
     189  //glEnable (GL_TEXTURE_2D);
    158190  //  glEnable(GL_COLOR);
    159191  //  glShadeModel(GL_SMOOTH);
     
    311343
    312344
     345SDL_Surface* Orxonox::getScreen ()
     346{
     347  return this->screen;
     348}
    313349
    314350
Note: See TracChangeset for help on using the changeset viewer.