I've been using TextureArray's in my current Project; However, I have come to the problem of OpenGL 4.2 functions not being on the present Mac software when ported over. Due to only version 4.1 of OpenGL being supported.
All my problems stem from the single function. glTexStorage3D which is the only function not supported.
This is how it currently works on my OpenGL 4.2 capable machine. (and works wonderfully I might add.)
1.) I allocate the memory beforehand with glTexStorage3D.
glGenTextures(1, &_texture); glBindTexture(GL_TEXTURE_2D_ARRAY, _texture); glTexStorage3D(GL_TEXTURE_2D_ARRAY, 255, GL_RGBA8, 16, 16, _maxLayerCount);
2.) Then per image I would load it into the before allocated memory block with the following.
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, _layerCount, 16, 16, 1, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
How would I go about mimicking this functionality pre OpenGL 4.2 without using Immutable Storage? Aka (glTexStorage3D).
I've tried stuffing all my images into a horizontal single image and then loading that into just glTexImage3D with no success. Am I missing something?
Additional Note: I prefer to use TextureArray's for my project in order to avoid rendering artifacts I had using a TextureAtlas. It's simplicity during shaders is also a big plus.