I am trying to load texture into GLuint (unsigned int). I did the following:
material[materialNum].texture = SOIL_load_OGL_texture((fileLocation + "/" + mtlBufferStr).c_str(), SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT);
This code works on debug mode. But on release mode I got run time error on "_file.c" (I did not create it) and the run time error is:
Unhandled exception at 0x771A8E19 (ntdll.dll) in Win32.exe: 0xC0000005: Access violation writing location 0x00000014
Why this run time error appears only on release mode and how do I solve it?
Edit: I add the full code of the program with the path of the file and without the GLuint. Stiil the same problem:
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow )
{
AllocConsole();
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
FILE* hf_out = _fdopen(hCrt, "w");
setvbuf(hf_out, NULL, _IONBF, 1);
*stdout = *hf_out;
SOIL_load_OGL_texture("models/havoc/tex_0007_1.dds", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT);
}
User contributions licensed under CC BY-SA 3.0