Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Using glTexImage3D() for Texture Arrays

$
0
0
When I create a Texture Array using glTexImage3D() (instead of glTexStorage3D()), am I supposed to call it for every texture in the array, or call it just once? glGenTextures(1, textureID); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D_ARRAY, textureID); //Configure the details of this texture object. glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, (mipmapLevels - 1)); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, /* blah */); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, /* blah */); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_R, /* blah */); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, /* blah */); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, /* blah */); //Allocate every texture in the array. for(GLint arrayIndex = 0; arrayIndex < this->details.textureLayers; ++arrayIndex) { //Allocate the texture on the GPU, with uninitialized data. glTexImage3D(GL_TEXTURE_2D_ARRAY, 0 /* mipmapLevel */, format, width, height, arrayIndex, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); }

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>