0
我現在讀了一本書。它關於OpenGl。有一個例子來加載與魔鬼紋理。 我已經實現了書1:1中的代碼。但iluFlipImage函數會導致圖形問題。 林使用.NET Framework 4.0 TOA框架2.1iluFlipImage導致圖形問題
翻轉
不翻轉
public void LoadTexture(string textureName, string path)
{
int devIlId;
Il.ilGenImages(1, out devIlId);
Gl.glBindTexture(Gl.GL_TEXTURE_2D, devIlId);
if (!Il.ilLoadImage(path))
{
System.Diagnostics.Debug.Assert(false,
"Could not open file, [" + path + "].");
}
Ilu.iluFlipImage();
var width = Il.ilGetInteger(Il.IL_IMAGE_WIDTH);
var height = Il.ilGetInteger(Il.IL_IMAGE_HEIGHT);
var textureId = Ilut.ilutGLBindTexImage();
System.Diagnostics.Debug.Assert(textureId != 0);
Il.ilDeleteImages(1, ref devIlId);
_textureStorage.Add(textureName, new Texture(textureId, path, width, height));
}