Changeset 3966 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Apr 26, 2005, 12:23:38 AM (20 years ago)
- 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 88 88 89 89 // setting the transparency 90 if (this->transparency == 1.0) 91 { 92 glDisable(GL_BLEND); 93 } 94 else 90 if (this->transparency < 1.0) 95 91 { 96 92 glEnable(GL_BLEND); … … 98 94 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 99 95 } 96 else 97 { 98 glDisable(GL_BLEND); 99 glColor4f(1.0f, 1.0f, 1.0f, 1.0f); 100 } 101 100 102 101 103 // setting illumination Model … … 109 111 glEnable(GL_TEXTURE_2D); 110 112 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 } 111 120 } 112 121 else -
orxonox/trunk/src/lib/graphics/importer/texture.cc
r3905 r3966 25 25 Texture::Texture(const char* imageName) 26 26 { 27 bAlpha = false; 27 28 this->texture = 0; 28 29 if (imageName) … … 112 113 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 113 114 SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha); 115 this->bAlpha = true; 114 116 } 115 117 … … 119 121 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 120 122 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 121 /* glTexImage2D(GL_TEXTURE_2D, 123 // build the Texture 124 glTexImage2D(GL_TEXTURE_2D, 122 125 0, 123 126 GL_RGBA, … … 127 130 GL_UNSIGNED_BYTE, 128 131 image->pixels); 129 */132 // build the MipMaps 130 133 gluBuild2DMipmaps(GL_TEXTURE_2D, 131 3,134 GL_RGBA, 132 135 w, 133 136 h, … … 135 138 GL_UNSIGNED_BYTE, 136 139 image->pixels); 137 140 138 141 SDL_FreeSurface(image); /* No longer needed */ 139 142 -
orxonox/trunk/src/lib/graphics/importer/texture.h
r3905 r3966 23 23 char* searchTextureInPaths(const char* texName) const; 24 24 void swap(unsigned char &a, unsigned char &b); 25 26 bool bAlpha; //!< if the texture has an alpha channel. 25 27 public: 26 28 Texture(const char* imageName = NULL); … … 30 32 inline GLuint getTexture(void) {return this->texture;} 31 33 GLuint loadTexToGL (SDL_Surface* surface); 34 inline bool hasAlpha(void) {return bAlpha;} 32 35 33 36 bool loadImage(const char* imageName);
Note: See TracChangeset
for help on using the changeset viewer.