Changeset 8312 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jun 11, 2006, 12:49:25 PM (18 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/material.cc
r8037 r8312 103 103 * @brief sets the material with which the following Faces will be painted 104 104 */ 105 bool Material::select() const105 bool Material::select() const 106 106 { 107 107 if (unlikely(this == Material::selectedMaterial)) … … 397 397 assert(textureNumber < this->textures.size()); 398 398 399 glActiveTexture(0); 399 // HACK 400 glActiveTexture(textureNumber); 400 401 glEnable(GL_TEXTURE_2D); 401 402 glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture()); -
trunk/src/lib/graphics/importer/texture.cc
r8293 r8312 151 151 152 152 153 Texture::Texture(GLenum target )153 Texture::Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type) 154 154 { 155 155 this->init(); 156 GLuint texture ;156 GLuint texture = 0; 157 157 Texture::generateTexture(texture, target); 158 159 glBindTexture(target, texture); 160 161 unsigned int* pixels = new unsigned int[width * height * channels]; 162 memset(pixels, 0, width * height * channels * sizeof(unsigned int)); 163 164 165 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 166 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 167 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 168 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 169 170 glTexImage2D(target, 0, channels, width, height, 0, type, GL_UNSIGNED_INT, pixels); 171 172 173 174 delete[] pixels; 175 158 176 this->data->setTexture(texture); 159 177 } … … 374 392 // printf("%s, w:%d h:%d, 0x%x\n", this->getName(), surface->w, surface->h, target); 375 393 394 /* control the mipmap levels */ 395 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 396 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 397 376 398 // build the MipMaps automaticaly 377 399 errorCode = gluBuild2DMipmaps(target, format, … … 400 422 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 401 423 402 /* control the mipmap levels */ 403 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 404 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 405 } 424 } -
trunk/src/lib/graphics/importer/texture.h
r8145 r8312 50 50 Texture(); 51 51 Texture(const Texture& texture); 52 Texture(GLenum target );52 Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type); 53 53 Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D); 54 54 Texture(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
Note: See TracChangeset
for help on using the changeset viewer.