0

I know that we can attach a layered texture which is:

A mipmap level of a 1D/2D texture array
A mipmap levevl of a 3D texture
A mipmap levevl of a Cube Texture/ Cube Texture Array

to a FBO and do layered rendering.

The OpenGL wiki also says "Layered rendering is the process of having the GS send specific primitives to different layers of a layered framebuffer."

Can default framebuffer be a layered framebuffer? i.e Can I bind a 3d texture to the default FB and use a geometry shader to render to different layers of this texture? I tried writing such a program but the screen is blank and I am not sure if this is right.

If it is not, what is possibly happening when I bind default FB for layered rendering?

viktorzeid
  • 1,521
  • 1
  • 22
  • 35

1 Answers1

1

If you use the default framebuffer for layered rendering, then everything you draw will go straight to the default framebuffer. They will behave as if everything were in the same layer.

OpenGL 4.4 Core Specification - 9.8 Layered Framebuffers - pp. 296

A framebuffer is considered to be layered if it is complete and all of its populated attachments are layered. When rendering to a layered framebuffer, each fragment generated by the GL is assigned a layer number.

[...]

A layer number written by a geometry shader has no effect if the framebuffer is not layered.

Community
  • 1
  • 1
Andon M. Coleman
  • 42,359
  • 2
  • 81
  • 106
  • So the conclusion is that default FB cannot be layered and hence gl_Layer has no effect? – viktorzeid Nov 20 '13 at 22:31
  • That is correct, you may hear of something called layer planes from time to time especially in WGL, but that is not the same thing as a layered framebuffer as far as GL is concerned. You can only attach images to FBOs, so I am not sure how you are binding a 3D texture and attempting to draw into it using the default framebuffer. – Andon M. Coleman Nov 20 '13 at 22:41