Ah..that would probably make sense. Alrighty, lemme get on that.
EDIT: Being that I'm lazy, I changed the function around to look like this:
void HVSTGFX::CTileSheet::createTile(int tileID, float x, float y)
{
float widthAdd = (tiles[tileID].pixWidth/2)*WIDTHSCALE;
float heightAdd = (tiles[tileID].pixHeight/2)*HEIGHTSCALE;
if (!sheet.loaded)
{
sheet.loaded = true;
glBindTexture(GL_TEXTURE_2D, sheet.texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, sheet.bitmapInfoHeader.biWidth, sheet.bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, sheet.sprite);
}
else
glBindTexture(GL_TEXTURE_2D, sheet.texture);
glColor3f(1.0f,1.0f,1.0f );
glBegin(GL_QUADS);
glTexCoord2f(tiles[tileID].glX, tiles[tileID].glY); glVertex3f(x, y, 0.0f);
glTexCoord2f(tiles[tileID].glX + tiles[tileID].glWidth, tiles[tileID].glY); glVertex3f(x + widthAdd, y, 0.0f);
glTexCoord2f(tiles[tileID].glX + tiles[tileID].glWidth, tiles[tileID].glY + tiles[tileID].glHeight); glVertex3f(x + widthAdd, y + heightAdd, 0.0f);
glTexCoord2f(tiles[tileID].glX, tiles[tileID].glY + tiles[tileID].glHeight); glVertex3f(x, y + heightAdd, 0.0f);
glEnd();
}
Except now all the quads are coming out white. So, the textures aren't even being applied now.
I also tried moving the code around for binding and such to a seperate function, but I get the same results.
EDIT: Fix'd. For some reason the CSprite constructor wasn't doing its job of intializing the loaded variable. It's all working now, thanks for your help!