Hello, I’ve been using an FBO writing to texture array layers successfully for a while, but as soon as I made a minor change, it broke, and I’m wondering about the source of the problem ( which most probably lie elsewhere).
I’m not sure if the process is completely right / in order. It’s the following :
bind fbo, set draw buffer as color attachment0
begin the appropriate shader, bind any textures / cubemaps needed
start a loop where :
—> bind the i-th textures / cubemaps for the shader
—> Attach the i-th layer of the texture array
—> set glGenerateMipmaps for texture_array_2d
—> render some stuff
—> unattach
disable fbo
restore drawbuffer
The change was in the loop count.
Now I get a framebuffer unsupported in the 2nd iteration of the loop. Do you find anything weird / wrong in the above flow?
Many thanks,
Babis
EDIT : I sometimes get a framebuffer_unsupported error, & sometimes I get a framebuffer_incomplete error
glDrawBuffer didn’t change anything.
What do you mean by float error?
About the binding, in order not to write every combination I tried & to summarize :
before I didn’t bind the texarray at all before the fbo attachment. I only bound it to 0 unit in rendering, & since probably no other texarray lies at unit 0, it wouldn’t change.
Now I bind it at 0 explicitly before attaching the layer, with LINEAR / CLAMP. But glGenerateMipmapsEXT causes my FBO to break.
My render filter for the texarray is LINEAR_MIPMAP_LINEAR/ CLAMP.
I managed to get it working, but without generating mipmaps.
Where should I place the glGenerateMipmapsEXT call to make it work correctly?
In addition to the above, I get those problems ONLY if my texture array has depth more than … 9. Lower than / equal to that, I can have mipmaps. More than that, only without mipmaps.
I am using a 53-layer 2D texture array in one of my programs, and I use glGenerateMipmaps on it and it generates no error, but then again I haven’t done too much with render-to-texture-array. Could be an FBO bug in the driver I suppose.
I did come across a mipmapping + render-to-texture-array bug once though (the GS was basically unaware that I was using mipmaps, and wrote into the wrong location in memory, but I notified NVIDIA of this and it is now fixed).
Thanks guys, at least I have an excuse not to blame myself now
If anyone though has successfully used texture arrays for render-to-many-slices, with glGenerateMipmaps on, successfully, I would like to hear his setup.
Have you created a complete mipmap chain for your textures? You have to do this even if you use glGenerateMipmapsEXT. So either manually set them up, or cheat and use the GL_GENERATE_MIPMAPS flag to the glTexParameteri()
manually setting them up means creating dummy data & passing them with texsubimage3D for each miplevel? I did that, but no luck again. And, even if it work, seems very paranoid to me, having to do this, and only if the depth of my texture array is greater than a specified size…
But, using GL_GENERATE_MIPMAPS along with glGenerateMipmapEXT(), eliminated a bug I was having where only the first set (in 1st frame) of the computed mipmaps were garbage, so thanks!