Archived

This topic is now archived and is closed to further replies.

Laz

Texture Loading making my game pause

Recommended Posts

Hey guys. Here''s a weird one. My game used to run fine. I wanted to load 2 textures into it, so I did. I loaded one at a time though. I loaded the first one and my game ran fine, but when I started loading the 2nd one, that''s when my game pauses. If I unpause it, it pauses again. Any idea what could be causing this? Here''s the incriminating code:
  
int LoadGLTextures()
{
  int Status = FALSE;
  AUX_RGBImageRec *TextureImage[1];

  memset(TextureImage, 0, sizeof(void *) * 1);
  if (TextureImage[0] = LoadBMP("Data/neatstars.bmp")) {
    Status = TRUE;
    glGenTextures(2, &texture[0]);
    glBindTexture(GL_TEXTURE_2D, texture[0]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
  }

  if (TextureImage[0] = LoadBMP("Data/tile.bmp")) {
    Status = TRUE;
    glGenTextures(2, &texture[1]);
    glBindTexture(GL_TEXTURE_2D, texture[1]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
  }
  if (TextureImage[0]) {
    if (TextureImage[0]->data) {
      free(TextureImage[0]->data);
    }

    free(TextureImage[0]);
  }

  return Status;
}
  
This is really ticking me off. Thanks. BTW - I have a variable named Pause (BOOL) which is set to TRUE when you either lose a life or press P. -Nick _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/http://www.lameware.com _/ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Share this post


Link to post
Share on other sites