- Timestamp:
- May 31, 2006, 3:38:38 PM (18 years ago)
- Location:
- branches/water/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/story_entities/game_world.cc
r8025 r8031 514 514 void GameWorld::renderPassRefraction() 515 515 { 516 /* 516 517 517 // clear buffer 518 518 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); … … 544 544 mw->deactivateRefraction(); 545 545 } 546 } */546 } 547 547 } 548 548 -
branches/water/src/world_entities/environments/mapped_water.cc
r8025 r8031 42 42 mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0); 43 43 // load refraction texture 44 mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1);44 //mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1); 45 45 // load normal map 46 mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);46 //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2); 47 47 // load dudv map 48 mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);48 //mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3); 49 49 // set up depth texture 50 mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);50 //mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4); 51 51 52 52 … … 60 60 unsigned int* pTextureReflection = new unsigned int [this->textureSize * this->textureSize * channels]; 61 61 memset(pTextureReflection, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int)); 62 unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];63 memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));62 //unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels]; 63 //memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int)); 64 64 // Register the texture with OpenGL and bind it to the texture ID 65 65 mat.select(); … … 72 72 73 73 //the same for the refraction 74 glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));75 glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);74 //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1)); 75 //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction); 76 76 77 77 // Set the texture quality … … 83 83 // Since we stored the texture space with OpenGL, we can delete the image data 84 84 delete [] pTextureReflection; 85 delete [] pTextureRefraction;85 //delete [] pTextureRefraction; 86 86 87 87 … … 148 148 glBegin(GL_QUADS); 149 149 // The back left vertice for the water 150 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, g_WaterUV); // Reflection texture150 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV); // Reflection texture 151 151 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move); // Refraction texture 152 152 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2); // Normal map texture … … 156 156 157 157 // The front left vertice for the water 158 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f); // Reflection texture158 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f); // Reflection texture 159 159 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move); // Refraction texture 160 160 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2); // Normal map texture … … 164 164 165 165 // The front right vertice for the water 166 glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, 0.0f); // Reflection texture166 glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f); // Reflection texture 167 167 glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move); // Refraction texture 168 168 glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2); // Normal map texture … … 172 172 173 173 // The back right vertice for the water 174 glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, g_WaterUV); // Reflection texture174 glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV); // Reflection texture 175 175 glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move); // Refraction texture 176 176 glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2); // Normal map texture … … 243 243 244 244 mat.select(); 245 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 245 //glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 246 //mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize); 246 247 247 248 glPopMatrix(); … … 250 251 251 252 void MappedWater::activateRefraction() 252 { /*253 { 253 254 // To create the refraction and depth textures we do the same thing 254 255 // we did for the reflection texture, except we don't need to turn … … 281 282 double plane[4] = {0.0, 1.0, 0.0, -waterHeight}; 282 283 glClipPlane(GL_CLIP_PLANE0, plane); 283 } */284 } 284 285 } 285 286 286 287 void MappedWater::deactivateRefraction() 287 { /*288 { 288 289 glDisable(GL_CLIP_PLANE0); 289 290 glCullFace(GL_BACK); 290 291 291 292 mat.select(); 293 mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize); 294 292 295 // Bind the current scene to our refraction texture 293 296 // glBindTexture(GL_TEXTURE_2D, g_Texture[REFRACTION_ID]); 294 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);297 // glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 295 298 296 299 // Bind the current scene to our depth texture 297 300 // glBindTexture(GL_TEXTURE_2D, g_Texture[DEPTH_ID]); 298 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0);301 // glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0); 299 302 300 303 glPopMatrix(); 301 304 glPopAttrib(); 302 */ 303 } 305 }
Note: See TracChangeset
for help on using the changeset viewer.