I want to use texture arrays to reduce the high texture binding cost, but I can't upload the data to the texture array. I use Tao framework. Here's my code:
Gl.glEnable(Gl.GL_TEXTURE_2D_ARRAY_EXT);
Gl.glGenTextures(1, out textureArray);
Gl.glBindTexture(Gl.GL_TEXTURE_2D_ARRAY_EXT, textureArray);
var data = new uint[textureWidth, textureHeight, textureCount];
for (var x = 0; x < textureWidth; x++)
{
for (var y = 0; y < textureHeight; y++)
{
for (var z = 0; z < textureCount; z++)
data[x, y, z] = GetRGBAColor(1, 1, 1, 1);
}
}
Gl.glTexImage3D(Gl.GL_TEXTURE_2D_ARRAY_EXT, 0, Gl.GL_RGBA, textureWidth,
textureHeight, textureCount, 0, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, data);
Console.WriteLine(Glu.gluErrorString(Gl.glGetError()));
The glTexImage3D function says there is an invalid enumerant.
glTexImage3D()actually generates the error? The above code just schecks if any GL call before that generates an error. Also, have you checked that your implementation actually supports theGL_EXT_texture_arrayextension?