Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 26, 2005, 12:23:38 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/particleEngine into the trunk, because of the new vector class
merged with command:
svn merge -r 3922:HEAD particleEngine/ ../trunk/

not merged src/story_entities/world.cc. will do this at a later time (do not forget)

Location:
orxonox/trunk/src/lib/graphics
Files:
3 edited
7 copied

Legend:

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

    r3914 r3966  
    8888 
    8989  // setting the transparency
    90   if (this->transparency == 1.0)
    91     {
    92       glDisable(GL_BLEND);
    93     }
    94   else
     90  if (this->transparency < 1.0)
    9591    {
    9692      glEnable(GL_BLEND);
     
    9894      glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    9995    }
     96  else
     97    {
     98      glDisable(GL_BLEND);
     99      glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
     100    }
     101
    100102
    101103  // setting illumination Model
     
    109111      glEnable(GL_TEXTURE_2D);
    110112      glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
     113
     114      /* This allows alpha blending of 2D textures with the scene */
     115      if (this->diffuseTexture->hasAlpha())
     116        {
     117          glEnable(GL_BLEND);
     118          glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     119        }
    111120    }
    112121  else
  • orxonox/trunk/src/lib/graphics/importer/texture.cc

    r3905 r3966  
    2525Texture::Texture(const char* imageName)
    2626{
     27  bAlpha = false;
    2728  this->texture = 0;
    2829  if (imageName)
     
    112113      if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
    113114        SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
     115        this->bAlpha = true;
    114116      }
    115117     
     
    119121      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    120122      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    121       /*      glTexImage2D(GL_TEXTURE_2D,
     123      // build the Texture
     124      glTexImage2D(GL_TEXTURE_2D,
    122125                   0,
    123126                   GL_RGBA,
     
    127130                   GL_UNSIGNED_BYTE,
    128131                   image->pixels);
    129       */
     132      // build the MipMaps
    130133      gluBuild2DMipmaps(GL_TEXTURE_2D,
    131                         3,
     134                        GL_RGBA,
    132135                        w,
    133136                        h,
     
    135138                        GL_UNSIGNED_BYTE,
    136139                        image->pixels);
    137 
     140     
    138141      SDL_FreeSurface(image); /* No longer needed */
    139142     
  • orxonox/trunk/src/lib/graphics/importer/texture.h

    r3905 r3966  
    2323  char* searchTextureInPaths(const char* texName) const;
    2424  void swap(unsigned char &a, unsigned char &b);
     25
     26  bool bAlpha;           //!< if the texture has an alpha channel.
    2527 public:
    2628  Texture(const char* imageName = NULL);
     
    3032  inline GLuint getTexture(void) {return this->texture;}
    3133  GLuint loadTexToGL (SDL_Surface* surface);
     34  inline bool hasAlpha(void) {return bAlpha;}
    3235
    3336  bool loadImage(const char* imageName);
Note: See TracChangeset for help on using the changeset viewer.