Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8095 in orxonox.OLD for branches


Ignore:
Timestamp:
Jun 1, 2006, 6:36:53 PM (19 years ago)
Author:
stefalie
Message:

water: refreshed textures dont work if we use more than one texture unit in a material

Location:
branches/water/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/lib/graphics/importer/material.cc

    r8089 r8095  
    397397  assert(textureNumber < this->textures.size());
    398398
    399   glActiveTexture(0);
     399  // HACK
     400  glActiveTexture(textureNumber);
    400401   glEnable(GL_TEXTURE_2D);
    401402   glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture());
  • branches/water/src/story_entities/game_world.cc

    r8089 r8095  
    538538  this->renderPassReflection();
    539539  // redner the refraction texture
    540   //this->renderPassRefraction();
     540  this->renderPassRefraction();
    541541  // render all
    542542  this->renderPassAll();
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8090 r8095  
    4040  // set up refleciton texture
    4141  //mat.setDiffuseMap(this->texture, 0);
    42   mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0);
     42  mat.setDiffuseMap("pictures/refl.jpg", GL_TEXTURE_2D, 0);
    4343  // load refraction texture
    44   mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1);
     44  mat.setDiffuseMap("pictures/refr.jpg", GL_TEXTURE_2D, 1);
    4545  // load normal map
    46   //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
     46  mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
    4747  // load dudv map
    48   //mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
     48  mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
    4949  // set up depth texture
    5050  //mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);
     
    9494  /// initialization of the shaders
    9595  // load shader files
    96 /*  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
     96  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
    9797
    9898  this->shader->activateShader();
     
    106106  Shader::Uniform(shader, "dudvMap").set(3);
    107107  // Set the variable "depthMap" to correspond to the fifth texture unit
    108   Shader::Uniform(shader, "depthMap").set(4);
     108  //Shader::Uniform(shader, "depthMap").set(4);
    109109  // Give the variable "waterColor" a blue color
    110110  Shader::Uniform(shader, "waterColor").set(0.1f, 0.2f, 0.4f, 1.0f);
     
    114114  cam_uni = new Shader::Uniform(shader, "cameraPos");
    115115
    116   this->shader->deactivateShader();*/
     116  this->shader->deactivateShader();
    117117}
    118118
     
    140140  mat.select();
    141141
    142   ///this->shader->activateShader();
     142  this->shader->activateShader();
    143143
    144144  // reset the camera uniform to the current cam position
    145145  Vector pos = State::getCameraNode()->getAbsCoor();
    146   ///cam_uni->set(pos.x, pos.y, pos.z, 1.0f);
     146  cam_uni->set(pos.x, pos.y, pos.z, 1.0f);
    147147
    148148  glBegin(GL_QUADS);
    149149  // The back left vertice for the water
    150   glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV);            // Reflection texture
    151   glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0);//refrUV - move);        // Refraction texture
     150 // glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV);            // Reflection texture
     151 // glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0);//refrUV - move);        // Refraction texture
     152  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, g_WaterUV);            // Reflection texture
     153  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move);        // Refraction texture
    152154  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2);     // Normal map texture
    153155  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                       // DUDV map texture
     
    156158
    157159  // The front left vertice for the water
    158   glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f);                  // Reflection texture
    159   glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1);//0.0f - move);           // Refraction texture
     160 // glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f);                  // Reflection texture
     161 // glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1);//0.0f - move);           // Refraction texture
     162  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);                  // Reflection texture
     163  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move);           // Refraction texture
    160164  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2);          // Normal map texture
    161165  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
     
    164168
    165169  // The front right vertice for the water
    166   glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f);             // Reflection texture
    167   glMultiTexCoord2f(GL_TEXTURE1, 1,1);//refrUV, 0.0f - move);         // Refraction texture
     170//  glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f);             // Reflection texture
     171 // glMultiTexCoord2f(GL_TEXTURE1, 1,1);//refrUV, 0.0f - move);         // Refraction texture
     172  glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, 0.0f);             // Reflection texture
     173  glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move);         // Refraction texture
    168174  glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2);      // Normal map texture
    169175  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
     
    172178
    173179  // The back right vertice for the water
    174   glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV);        // Reflection texture
    175   glMultiTexCoord2f(GL_TEXTURE1, 1,0);//refrUV, refrUV - move);       // Refraction texture
     180 // glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV);        // Reflection texture
     181 // glMultiTexCoord2f(GL_TEXTURE1, 1,0);//refrUV, refrUV - move);       // Refraction texture
     182  glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, g_WaterUV);        // Reflection texture
     183  glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move);       // Refraction texture
    176184  glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
    177185  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
     
    180188  glEnd();
    181189
    182   ///this->shader->deactivateShader();
     190  this->shader->deactivateShader();
    183191
    184192  mat.unselect();
     
    293301
    294302  mat.select();
    295   //mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     303  mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    296304  //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0);
    297305  //mat.renderToTexture(0, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, textureSize, textureSize, 0);
Note: See TracChangeset for help on using the changeset viewer.