42 Textures::Textures(
void ) {
44 switchRGB2BGR =
false;
53 for(
unsigned int i=0; i < textures.size(); i++ )
73 switchRGB2BGR = value;
83 if( texture >= textures.size() )
85 if( textures[texture] == -1 )
89 GLuint
id = (GLuint) textures[texture];
90 glDeleteTextures( 1, &
id );
91 textures[texture] = -1;
105 if( texture >= textures.size() )
106 reserve( texture + 1 );
108 if( textures[texture] != -1 ) {
109 freeTexture( texture );
113 glGenTextures ( 1, &
id );
114 textures[texture] = (int)
id;
120 texLoader->load( filename );
125 texLoader->load( filename );
127 texLoader->write(
"testoutput.tga");
131 bindTexture( texture );
138 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
139 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR );
142 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
143 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
148 if( texLoader->isBGR() )
151 usedFormat = GL_BGR_EXT;
153 usedFormat = texLoader->getFormat();
158 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, texLoader->getWidth(), texLoader->getHeight(), usedFormat, GL_UNSIGNED_BYTE, texLoader->getImage() );
171 if( texture >= textures.size() )
172 reserve( texture + 1 );
174 if( textures[texture] != -1 ) {
175 freeTexture( texture );
179 glGenTextures ( 1, &
id );
180 textures[texture] = (int)
id;
183 bindTexture( texture );
190 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
191 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
199 if( loader->
isBGR() )
202 usedFormat = GL_BGR_EXT;
209 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, loader->
getWidth(), loader->
getHeight(), usedFormat, GL_UNSIGNED_BYTE, loader->
getImage() );
222 if( textureCount <= textures.size() )
225 size_t oldSize = textures.size();
227 textures.reserve( textureCount );
228 textures.resize ( textureCount );
231 for(
size_t i=oldSize; i < textures.size(); i++ )
247 if( texture >= textures.size() )
249 if( textures[texture] == -1 )
252 glBindTexture( GL_TEXTURE_2D, textures[texture] );