Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top