Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6523 in orxonox.OLD for trunk/src/world_entities/skybox.cc


Ignore:
Timestamp:
Jan 18, 2006, 2:54:04 AM (18 years ago)
Author:
bensch
Message:

trunk: water fake render :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/skybox.cc

    r6519 r6523  
    102102  this->setModel(NULL); //< so that WorldEntity does not try to delete it again.
    103103  for (int i = 0; i < 6; i++)
     104  {
    104105    delete this->material[i];
     106    delete this->cubeTexture[i];
     107  }
    105108}
    106109
     
    159162  this->material[4]->setDiffuseMap(front);
    160163  this->material[5]->setDiffuseMap(back);
    161   this->loadCubeMapTextures(top, bottom, left, right, front, back);
    162   //this->enableCubeMap();
     164  if (GLEW_EXT_texture_cube_map)
     165    this->loadCubeMapTextures(top, bottom, left, right, front, back);
    163166}
    164167
     
    166169                                  const char* right, const char* front, const char* back)
    167170{
    168   this->cubeTexture[0] = new Texture (top, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB);
    169   this->cubeTexture[1] = new Texture (bottom, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB);
    170   this->cubeTexture[2] = new Texture (left, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
    171   this->cubeTexture[3] = new Texture (right, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB);
    172   this->cubeTexture[4] = new Texture (front, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB);
    173   this->cubeTexture[5] = new Texture (back, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB);
     171  this->cubeTexture[0] = new Texture (top, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
     172  this->cubeTexture[1] = new Texture (bottom, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
     173  this->cubeTexture[2] = new Texture (left, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
     174  this->cubeTexture[3] = new Texture (right, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
     175  this->cubeTexture[4] = new Texture (front, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
     176  this->cubeTexture[5] = new Texture (back, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
    174177}
    175178
    176179void SkyBox::enableCubeMap()
    177180{
    178   glEnable(GL_TEXTURE_CUBE_MAP_ARB);
    179181  glEnable(GL_TEXTURE_2D);
    180   glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
    181   glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
    182   glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
     182  glEnable(GL_TEXTURE_CUBE_MAP_EXT);
     183  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
     184  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
     185  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
    183186  glEnable(GL_TEXTURE_GEN_S);
    184187  glEnable(GL_TEXTURE_GEN_T);
    185188  glEnable(GL_TEXTURE_GEN_R);
     189
    186190}
    187191
    188192void SkyBox::disableCubeMap()
    189193{
    190   glDisable(GL_TEXTURE_CUBE_MAP_ARB);
     194  glDisable(GL_TEXTURE_CUBE_MAP_EXT);
    191195  glDisable(GL_TEXTURE_2D);
     196  glDisable(GL_TEXTURE_GEN_S);
     197  glDisable(GL_TEXTURE_GEN_T);
     198  glDisable(GL_TEXTURE_GEN_R);
     199
    192200  glDisable(GL_TEXTURE_GEN_S);
    193201  glDisable(GL_TEXTURE_GEN_T);
Note: See TracChangeset for help on using the changeset viewer.