Changeset 8034 in orxonox.OLD
- Timestamp:
- May 31, 2006, 4:19:33 PM (18 years ago)
- Location:
- branches/water/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/lib/graphics/importer/material.cc
r8027 r8034 390 390 * @param textureNumber select the texture unit that will be overwritten 391 391 */ 392 void Material::renderToTexture(unsigned int textureNumber, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)392 void Material::renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) 393 393 { 394 394 glActiveTexture(Material::glTextureArbs[textureNumber]); 395 395 glEnable(GL_TEXTURE_2D); 396 396 glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture()); 397 glCopyTexSubImage2D(target, 0, xoffset, yoffset, 0, 0, width, height);397 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 398 398 } 399 399 -
branches/water/src/lib/graphics/importer/material.h
r8027 r8034 58 58 void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 59 59 void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 60 void renderToTexture(unsigned int textureNumber, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);60 void renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); 61 61 62 62 void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D); -
branches/water/src/world_entities/environments/mapped_water.cc
r8031 r8034 39 39 /// loads the textures 40 40 // set up refleciton texture 41 // FIXME mat.setDiffuseMap(this->texture, 0); doesnt work,41 //mat.setDiffuseMap(this->texture, 0); 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 46 //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2); … … 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 … … 149 149 // The back left vertice for the water 150 150 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV); // Reflection texture 151 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move); // Refraction texture151 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0);//refrUV - move); // Refraction texture 152 152 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2); // Normal map texture 153 153 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 157 157 // The front left vertice for the water 158 158 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f); // Reflection texture 159 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move); // Refraction texture159 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1);//0.0f - move); // Refraction texture 160 160 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2); // Normal map texture 161 161 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 165 165 // The front right vertice for the water 166 166 glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f); // Reflection texture 167 glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move); // Refraction texture167 glMultiTexCoord2f(GL_TEXTURE1, 1,1);//refrUV, 0.0f - move); // Refraction texture 168 168 glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2); // Normal map texture 169 169 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 173 173 // The back right vertice for the water 174 174 glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV); // Reflection texture 175 glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move); // Refraction texture175 glMultiTexCoord2f(GL_TEXTURE1, 1,0);//refrUV, refrUV - move); // Refraction texture 176 176 glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2); // Normal map texture 177 177 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 244 244 mat.select(); 245 245 //glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 246 //mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize);246 mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 247 247 248 248 glPopMatrix(); … … 291 291 292 292 mat.select(); 293 mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize); 293 mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 294 //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0); 295 //mat.renderToTexture(0, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, textureSize, textureSize, 0); 294 296 295 297 // Bind the current scene to our refraction texture
Note: See TracChangeset
for help on using the changeset viewer.