On 09/12/13 16:34, Cathy L. wrote:
> I have several questions about the use of 2D texture arrays.
> - before using glGenTextures/glBindTexture/glTexParameteri/glTexImage3D,
> do I need to glEnable(GL_TEXTURE_3D) or glEnable(GL_TEXTURE_2D_ARRAY)?
No. glEnable(GL_TEXTURE_...) selects the specified texture target fixed
function pipeline sampling source for the active texturing unit. If
you're using shaders, you don't need glEnable(GL_TEXTURE_...) at all.
> - Is the way to compute the "depth" (the third) texture coordinate the
> similar to the way for 3D texture in the shader?
The third coordinate is the integer texture layer. If specified as a
floating point coordinate the integer part is used as if calculated by
actual_layer = max(0, min(d - 1, floor(layer + 0.5)) )
where d is the number of layers, and layer the accessed layer. I.e.
layer gets clamped into the range [0, d-1] and proper rounding is applied.