New to DevIl and 3D Textures
Hello,
I have a question about constructing 3D Images with DevIl for use in OpenGL. I have never used 3D textures so far, but the result of my code is always a plain grey texture. The Code I have so far:
int GenerateTexture(string szFileName1, string szFileName2, string szFileName3, string szFileName4)
{
int hTexture = 0;
int[] hIlTexture = new int[1];
Il.ilGenImages(1, hIlTexture);
Il.ilSetInteger(Il.IL_IMAGE_WIDTH, 256);
Il.ilSetInteger(Il.IL_IMAGE_HEIGHT, 256);
Il.ilSetInteger(Il.IL_IMAGE_BPP, 24);
Il.ilSetInteger(Il.IL_IMAGE_DEPTH, 4);
Il.ilSetInteger(Il.IL_IMAGE_FORMAT, Gl.GL_RGB);
Il.ilSetInteger(Il.IL_IMAGE_TYPE, Gl.GL_UNSIGNED_BYTE);
Gl.glEnable(Gl.GL_TEXTURE_3D);
Gl.glBindTexture(Gl.GL_TEXTURE_3D, hTexture);
Il.ilBindImage(hIlTexture[0]);
Il.ilLoadData(szFileName1, 256, 256, 0, 24);
Il.ilLoadData(szFileName2, 256, 256, 1, 24);
Il.ilLoadData(szFileName3, 256, 256, 2, 24);
Il.ilLoadData(szFileName4, 256, 256, 3, 24);
Gl.glTexParameteri(Gl.GL_TEXTURE_3D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
Gl.glTexParameteri(Gl.GL_TEXTURE_3D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST_MIPMAP_LINEAR);
Gl.glTexParameteri(Gl.GL_TEXTURE_3D, Gl.GL_TEXTURE_WRAP_S, Gl.GL_REPEAT);
Gl.glTexParameteri(Gl.GL_TEXTURE_3D, Gl.GL_TEXTURE_WRAP_T, Gl.GL_REPEAT);
Gl.glTexEnvi(Gl.GL_TEXTURE_3D, Gl.GL_TEXTURE_ENV_MODE, Gl.GL_MODULATE);
Gl.glTexImage3D(Gl.GL_TEXTURE_3D,
0,
Il.ilGetInteger(Il.IL_IMAGE_BPP),
Il.ilGetInteger(Il.IL_IMAGE_WIDTH),
Il.ilGetInteger(Il.IL_IMAGE_HEIGHT),
Il.ilGetInteger(Il.IL_IMAGE_DEPTH),
0,
Il.ilGetInteger(Il.IL_IMAGE_FORMAT),
Il.ilGetInteger(Il.IL_IMAGE_TYPE),
Il.ilGetData());
return hTexture;
}
So what am I doing wrong? Is there a way to store 3D textures in a file and when which format?
Thanks in advance,
Andre

You seem to be enabling
You seem to be enabling mipmapping on the texture "Gl.glTexParameteri(Gl.GL_TEXTURE_3D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST_MIPMAP_LINEAR);",
but you only provide mipmap level 0 to GL.