Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6523 in orxonox.OLD


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

trunk: water fake render :)

Location:
trunk/src
Files:
4 edited

Legend:

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

    r6522 r6523  
    474474void GraphicsEngine::wireframe()
    475475{
    476   glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
     476  glPolygonMode(GL_FRONT, GL_LINE);
    477477}
    478478
  • trunk/src/lib/graphics/importer/texture.cc

    r6465 r6523  
    276276               0,
    277277               GL_RGBA,
    278                surface->w, surface->h,
     278               surface->w,
     279               surface->h,
    279280               0,
    280281               GL_RGBA,
     
    294295    PRINTF(1)("Error while loading texture (mipmap generation), gluBuild2DMipmaps returned %i\n", errorCode);
    295296
    296   glBindTexture(target, 0);
     297  if (target == GL_TEXTURE_2D)
     298    glBindTexture(target, 0);
    297299  return texture;
    298300}
  • trunk/src/world_entities/environments/water.cc

    r6522 r6523  
    120120void Water::draw() const
    121121{
    122   SkyBox::enableCubeMap();
    123 
    124  // this->waterShader->activateShader();
     122  //SkyBox::enableCubeMap();
     123
     124  glBindTexture(GL_TEXTURE_2D, 15);
     125  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     126
     127  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
     128  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
     129  glEnable(GL_TEXTURE_GEN_S);
     130  glEnable(GL_TEXTURE_GEN_T);
     131
     132  glEnable(GL_BLEND);
     133  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     134  // this->waterShader->activateShader();
    125135//  this->waterMaterial->select();
    126136  WorldEntity::draw();
  • 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.