Hi guys,
I started some months ago an OpenGL project which became larger and larger... I began with the crashLanding sample and i use Texture2D.
I also use a singleton class to load my textures, and here is what the texture load looks like :
//Load the background texture and configure it
_textures[kTexture_Background] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"fond.png"]];
glBindTexture(GL_TEXTURE_2D, [_textures[kTexture_Background] name]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// Load the textures
_textures[kTexture_Batiment] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"batiment_Ext.png"]];
_textures[kTexture_Balcon] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"balcon.png"]];
_textures[kTexture_Devanture] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"devanture.png"]];
_textures[kTexture_Cactus_Troncs] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"cactus-troncs.png"]];
_textures[kTexture_Cactus_Gauche] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"cactus1.png"]];
_textures[kTexture_Cactus_Droit] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"cactus2.png"]];
_textures[kTexture_Pierre] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"pierre.png"]];
_textures[kTexture_Enseigne] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"enseigne.png"]];
_textures[kTexture_Menu] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"saloonIntro.jpg"]];
_textures[kTexture_GameOver] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"gameOver.jpg"]];
for (int i = 0 ; i < kNumTexturesScene ; i ++)
{
[arrayOfText addObject:[[[NSData alloc] init] autorelease]];
}
// sort my array
for (int i = 0 ; i < kNumTexturesScene ; i ++)
{
[arrayOfText replaceObjectAtIndex:i withObject:_textures[i]];
}
[dictionaryOfTexture setObject:[arrayOfText copy] forKey:kTextureDecor];
[arrayOfText removeAllObjects];
and so on for almost 50 pictures
It works well on the 3GS but there are some issues sometimes with 3G.
Am i wrong with all of this ?
Thanks