Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5260 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Sep 26, 2005, 2:28:46 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: checking for HW-extensions

Location:
trunk/src/lib/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/graphics_engine.cc

    r5255 r5260  
    5353  this->videoFlags = 0;
    5454  this->screen = NULL;
     55
     56
     57  // Hardware
     58  this->hwRenderer = NULL;
     59  this->hwVendor = NULL;
     60  this->hwVersion = NULL;
     61  this->hwExtensions = NULL;
    5562}
    5663
     
    6976  delete this->geTextMaxFPS;
    7077  delete this->geTextMinFPS;
     78
     79  delete[] this->hwRenderer;
     80  delete[] this->hwVendor;
     81  delete[] this->hwVersion;
     82  delete this->hwExtensions;
    7183
    7284  delete Render2D::getInstance();
     
    159171  this->setResolution(resX, resY, bbp);
    160172
     173  // GRABBING ALL GL-extensions
     174  this->grabHardwareSettings();
     175
    161176  // Enable default GL stuff
    162177  glEnable(GL_DEPTH_TEST);
     
    208223  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
    209224  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
     225}
     226
     227void GraphicsEngine::grabHardwareSettings()
     228{
     229  const char* renderer = (const char*) glGetString(GL_RENDERER);
     230  const char* vendor   = (const char*) glGetString(GL_VENDOR);
     231  const char* version  = (const char*) glGetString(GL_VERSION);
     232  const char* extensions = (const char*) glGetString(GL_EXTENSIONS);
     233
     234//  printf("%s %s %s\n %s", renderer, vendor, version, extensions);
     235
     236  if (this->hwRenderer == NULL && renderer != NULL)
     237  {
     238    this->hwRenderer = new char[strlen(renderer)+1];
     239    strcpy(this->hwRenderer, renderer);
     240  }
     241  if (this->hwVendor == NULL && vendor != NULL)
     242  {
     243    this->hwVendor = new char[strlen(vendor)+1];
     244    strcpy(this->hwVendor, vendor);
     245  }
     246  if (this->hwVersion == NULL && version != NULL)
     247  {
     248    this->hwVersion = new char[strlen(version)+11];
     249    strcpy(this->hwVersion, version);
     250  }
     251
     252  if (this->hwExtensions == NULL && extensions != NULL)
     253    this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), true);
     254
     255  PRINT(4)("Running on : %s %s %s\n", vendor, renderer, version);
     256  PRINT(4)("Extensions:\n");
     257  if (this->hwExtensions != NULL)
     258    for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++)
     259      PRINT(4)("%d: %s\n", i, this->hwExtensions->getString(i));
    210260}
    211261
     
    230280      //    return -1;
    231281    }
     282    glViewport(0,0,width,height);                                                   // Reset The Current Viewport
    232283}
    233284
  • trunk/src/lib/graphics/graphics_engine.h

    r5216 r5260  
    1818class Text;
    1919class IniParser;
     20class SubString;
    2021
    2122//! class to handle graphics
     
    7879    int initVideo(unsigned int resX, unsigned int resY, unsigned int bbp);
    7980    int setGLattribs();
     81    void grabHardwareSettings();
    8082
    8183  public:
     
    100102    float                   minFPS;          //!< minimal frame rate we ever got since start
    101103
     104    // HARDWARE-Settings:
     105    char*                   hwRenderer;
     106    char*                   hwVendor;
     107    char*                   hwVersion;
     108    SubString*              hwExtensions;
    102109
    103110#ifndef NO_TEXT
Note: See TracChangeset for help on using the changeset viewer.