Changeset 8089 in orxonox.OLD for branches/water/src/lib/graphics/importer/texture.cc
- Timestamp:
- Jun 1, 2006, 5:24:57 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/lib/graphics/importer/texture.cc
r7790 r8089 115 115 116 116 117 Texture::Texture(GLenum target )117 Texture::Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type) 118 118 { 119 119 this->init(); 120 GLuint texture ;120 GLuint texture = 0; 121 121 Texture::generateTexture(texture, target); 122 123 glBindTexture(target, texture); 124 125 unsigned int* pixels = new unsigned int[width * height * channels]; 126 memset(pixels, 0, width * height * channels * sizeof(unsigned int)); 127 128 129 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 130 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 131 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 132 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 133 134 glTexImage2D(target, 0, channels, width, height, 0, type, GL_UNSIGNED_INT, pixels); 135 136 137 138 delete[] pixels; 139 122 140 this->data->setTexture(texture); 123 141 } … … 346 364 // printf("%s, w:%d h:%d, 0x%x\n", this->getName(), surface->w, surface->h, target); 347 365 366 /* control the mipmap levels */ 367 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 368 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 369 348 370 // build the MipMaps automaticaly 349 371 errorCode = gluBuild2DMipmaps(target, format, … … 372 394 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 373 395 374 /* control the mipmap levels */ 375 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 376 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 377 } 396 }
Note: See TracChangeset
for help on using the changeset viewer.