Texture Array

Hi, can someone explain how can I use it?
I have 3 textures and I’m putting them into array. Is it proper way?

        int width = 1024;
	int height = 1024;
	GLuint ID;
	glGenTextures(1, &ID);
	glBindTexture(GL_TEXTURE_2D_ARRAY, ID);
	glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, width, height, 3)
	glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, data[0]);
	glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 1, width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, data[1]);
	glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 2, width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, data[2]);
	glBindTexture(GL_TEXTURE_2D_ARRAY, 0);

but I don’t know how to set texture to render. I use immediate mode (I will change it to VBO later) but firstly I want to know how to use this array properly. Textures are 2D, I use GLUT and glext.

Looks pretty close if you don’t want MIPmaps. However, you’ve got a few copy/paste bugs in your glTexParameter calls (the first arg for both calls, as well as the value you’re setting for the MIN filter). Since you’re not allocating MIPmaps, you don’t want to use a MIN filter that expects them.

As to how to render with this texarray, you’re going to need to write shaders to be able to sample (read) from them when texturing your fragments.