FBO - texture_2D_array problems

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

How do you bind textureArray ?

Is it float error ?

Oh.
I think you have to restore drawBuffer firstly. And only after that disable FBO.

Hi innuendo, thanks for your quick response.

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?

Many thanks,
babis

Try to use glGenerateMipmapsEXT in FBO’s creation, not in render loop.

‘float error’ equal ‘fuzzy error’
in Russain language:)

Good luck

The problem is that in the FBO creation I only attach a depth buffer, since the layer attachments change continuously every frame…

I also tried replacing glGenerateMipmapsEXT with glTexParameteri(GL_GENERATE_MIPMAP), but no results.

Thanks for your help.

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.

Meanwhile, GL_MAX_ARRAY_TEXTURE_LAYERS_EXT returns 512.

Does anything make sense??

Hm, seems you have run into a bug/limitation of nvidia hardware (or driver) :slight_smile:

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. :slight_smile:

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 :slight_smile:

If anyone though has successfully used texture arrays for render-to-many-slices, with glGenerateMipmaps on, successfully, I would like to hear his setup.

So, can you try to use FramebufferTextureLayerEXT with layer= zero in FBO’s creation ?

If I do this & use glGenerateMipmapEXT once, at creation time, it seems that only my mipmaps, are garbage.

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()

Thanks Mars_999,

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! :slight_smile:

You don’t need to create dummy data… a NULL data pointer is sufficient for creating a level.