Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8312 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Jun 11, 2006, 12:49:25 PM (18 years ago)
Author:
bensch
Message:

trunk: merged the water-branche back here
removed the HACK in GameWorld in the Process (hope it is not needed anymore…

merged with command:
svn merge https://svn.orxonox.net/orxonoanches/water/src/lib/gui/gl_gui src/lib/gui/gl/ -r8063:HEAD

Location:
trunk/src/lib/graphics/importer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/material.cc

    r8037 r8312  
    103103 * @brief sets the material with which the following Faces will be painted
    104104 */
    105 bool Material::select() const
     105  bool Material::select() const
    106106{
    107107  if (unlikely(this == Material::selectedMaterial))
     
    397397  assert(textureNumber < this->textures.size());
    398398
    399   glActiveTexture(0);
     399  // HACK
     400  glActiveTexture(textureNumber);
    400401   glEnable(GL_TEXTURE_2D);
    401402   glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture());
  • trunk/src/lib/graphics/importer/texture.cc

    r8293 r8312  
    151151
    152152
    153 Texture::Texture(GLenum target)
     153Texture::Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type)
    154154{
    155155  this->init();
    156   GLuint texture;
     156  GLuint texture = 0;
    157157  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
    158176  this->data->setTexture(texture);
    159177}
     
    374392  //  printf("%s, w:%d h:%d, 0x%x\n", this->getName(), surface->w, surface->h, target);
    375393
     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
    376398  // build the MipMaps automaticaly
    377399  errorCode = gluBuild2DMipmaps(target, format,
     
    400422  glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    401423
    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  
    5050  Texture();
    5151  Texture(const Texture& texture);
    52   Texture(GLenum target);
     52  Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type);
    5353  Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
    5454  Texture(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
Note: See TracChangeset for help on using the changeset viewer.