我正在尝试将纹理加载到GLuint(unsigned int)中。我做了以下事情:
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);
此代码适用于调试模式。但是在发布模式下,我在" _file.c"上遇到了运行时错误。 (我没有创建它),运行时错误是:
Win32.exe中0x771A8E19(ntdll.dll)的未处理异常:0xC0000005:访问冲突写入位置0x00000014
为什么此运行时错误仅在发布模式下出现,如何解决?
编辑:我使用文件的路径添加程序的完整代码,而不使用GLuint。搅拌同样的问题:
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);
}