View Full Version : Array Textures
10-14-2010, 01:58 AM
Simple question regarding Array Textures. I have never used them, but am looking at them as an alternative to an array of samplers. Can one bind a TEXTURE_2D to a specific layer of a TEXTURE_2D_ARRAY easily, or does the memory have to be "contiguous" and thus copied into the TEXTURE_2D_ARRAY with a TexSubImage ?
My shader requires a set of textures which may change each frame. I'd like to be able to pick the texture using an index into an array.
Is this possible?
10-14-2010, 07:04 AM
I have part of your answer:
Yes, texture arrays are a great alternative to the hacked implementation (personal opinion) of array of samplers.
The only drawback compared to an array of samplers is that all your textures must have the same resolution.
Haven't used texsubimage with them, not sure how that works....
10-14-2010, 08:07 AM
No, you can't bind a GL_TEXTURE_2D into a GL_TEXTURE_2D_ARRAY. They could add that feature if it is considered important.
It needs to be contiguous if you want to use glTexImage3D to create a GL_TEXTURE_2D_ARRAY or you can call glTexImage3D with a NULL pointer and glTexImage3D will just allocate the memory space.
Then it is up to you to fill each layer with glTexSubImage3D.
10-14-2010, 10:48 AM
Cool thanks a lot
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.