bool loadPlayerImages(const char* dir, const char* ext, int num_sprites)
{
for (i=0;i<=num_sprites;i+=1)
{
using namespace std;
string file = ToString( dir ) + ToString( i ) + ToString( ext );
const char* pszConstString = file.c_str ();
MessageBox(0, pszConstString, "ERROR", MB_OK);
player_image[i] = SOIL_load_OGL_texture
(
pszConstString,
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);
glGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_WIDTH, &width[i]);
glGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_HEIGHT, &height[i]);
};
}
Its suppose to take dir, i, and ext and add them together to get a const char* string thats looks like this:
img/1.bmp
For some reason it crashes the program. What am I doing wrong?
Thanks,
~Justin123