這裏不能打開文件可以是代碼:與魔鬼
public void LoadTexture(string textureId, string path)
{
int devilId = 0;
Il.ilGenImages(1, out devilId);
Il.ilBindImage(devilId); // set as the active texture
if (!Il.ilLoadImage(path))
{
System.Diagnostics.Debug.Assert(false, "Could not open file, [" + path + "].");
}
// The files we'll be using need to be flipped before passing to OpenGL
Ilu.iluFlipImage();
int width = Il.ilGetInteger(Il.IL_IMAGE_WIDTH);
int height = Il.ilGetInteger(Il.IL_IMAGE_HEIGHT);
int openGLId = Ilut.ilutGLBindTexImage();
System.Diagnostics.Debug.Assert(openGLId != 0);
Il.ilDeleteImages(1, ref devilId);
_textureDatabase.Add(textureId, new Texture(openGLId, width, height));
}
我越來越無法斷言,無法打開文件[face.tif]錯誤。我確信face.tif文件位於項目文件夾,解決方案文件夾,bin文件夾,bin \ debug文件夾中,但仍然無法打開它。
我正在嘗試遵循C#遊戲編程的書籍來製作嚴肅的遊戲。
在Form1.cs我有一個_textureManager.LoadTexture( 「臉」,「 face.tif「); – Liam15
文件'face.tif'與你的應用程序運行的地方('.exe')在哪裏? –
它們都位於bin \ debug文件夾中。換句話說,它們在同一個文件夾中 – Liam15