Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

water: hack… but now i got 3 of the 4 needed textures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8095 r8235  
    4040  // set up refleciton texture
    4141  //mat.setDiffuseMap(this->texture, 0);
    42   mat.setDiffuseMap("pictures/refl.jpg", GL_TEXTURE_2D, 0);
     42  mat.setDiffuseMap("pictures/refl.bmp", GL_TEXTURE_2D, 0);
    4343  // load refraction texture
    44   mat.setDiffuseMap("pictures/refr.jpg", GL_TEXTURE_2D, 1);
     44  mat.setDiffuseMap("pictures/refr.bmp", GL_TEXTURE_2D, 1);
    4545  // load normal map
    4646  mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
     
    7474  //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
    7575  //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
     76
     77  unsigned int channels = 32;
     78  GLenum type = GL_RGBA;
     79  unsigned int* pTextureReflection = new unsigned int [this->textureSize * this->textureSize * channels];
     80  memset(pTextureReflection, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
     81  mat.select();
     82  glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
     83  glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureReflection);
     84
     85
     86
    7687
    7788  // Set the texture quality
     
    252263
    253264  mat.select();
    254   //glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    255   mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    256 
     265  /////glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     266  ///mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     267  ///
     268
     269  mat.select();
     270  glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
     271
     272  // Create the texture and store it on the video card
     273  glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     274 
     275 
     276  ///
    257277  glPopMatrix();
    258278  glPopAttrib();
     
    301321
    302322  mat.select();
    303   mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     323  //mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    304324  //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0);
    305325  //mat.renderToTexture(0, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, textureSize, textureSize, 0);
Note: See TracChangeset for help on using the changeset viewer.