Changeset 8037 in orxonox.OLD for trunk/src/lib/graphics/importer
- Timestamp:
- May 31, 2006, 4:52:34 PM (18 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/material.cc
r7922 r8037 108 108 return true; 109 109 110 /// !! HACK !!! FIX THIS IN MODEL /// 111 else if (likely(Material::selectedMaterial != NULL)) 112 { 113 Material::unselect(); 114 // for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i) 115 // { 116 // glActiveTexture(Material::glTextureArbs[i]); 117 // glBindTexture(GL_TEXTURE_2D, 0); 118 // glDisable(GL_TEXTURE_2D); 119 // } 120 } 121 110 122 if (likely(Material::selectedMaterial != NULL)) 111 123 { … … 146 158 glShadeModel(GL_SMOOTH); 147 159 148 149 160 for(unsigned int i = 0; i < this->textures.size(); ++i) 150 161 { … … 160 171 } 161 172 173 void Material::unselect() 174 { 175 Material::selectedMaterial = NULL; 176 for(unsigned int i = 0; i < 8; ++i) 177 { 178 glActiveTexture(Material::glTextureArbs[i]); 179 glBindTexture(GL_TEXTURE_2D, 0); 180 glDisable(GL_TEXTURE_2D); 181 } 182 } 183 162 184 /** 163 185 * Sets the Material Illumination Model. … … 366 388 } 367 389 390 /** 391 * @brief renders viewport buffer (?? or another buffer ;-)) to a texture 392 * @param textureNumber select the texture unit that will be overwritten 393 */ 394 void Material::renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) 395 { 396 assert(textureNumber < Material::getMaxTextureUnits()); 397 assert(textureNumber < this->textures.size()); 398 399 glActiveTexture(0); 400 glEnable(GL_TEXTURE_2D); 401 glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture()); 402 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 403 404 } 368 405 369 406 /** 370 407 * @brief Sets the Materials Ambient Map 371 * @param aMap the Name of the Image to Use 372 @todo implement this 408 * @todo implement this 373 409 */ 374 410 void Material::setAmbientMap(const std::string& aMap, GLenum target) -
trunk/src/lib/graphics/importer/material.h
r7919 r8037 30 30 31 31 bool select () const; 32 bool activateTextureUnit(unsigned int textureNumber); 33 static void unselect(); 32 34 33 35 void setIllum (int illum); … … 55 57 void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 56 58 void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 59 void renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); 57 60 58 61 void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
Note: See TracChangeset
for help on using the changeset viewer.