kanato's picture

Framebuffer extension

I'm playing around with FrameBuffer objects, and from looking at examples on the web it seems that GL.Ext.RenderbufferStorage can take parameters not listed in the RenderbufferStorage enum. Actually, from the examples, it looks like it should be members of the PixelFormat enum?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

There's a FBO cleanup upcoming for 0.9.1 (somehow got overlooked in the changes for 0.9.0), it'd be very much appreciated if you confirm the changed enums to be correct.

http://www.opentk.com/node/228

kanato's picture

I'm using the SVN version now, so it looks to be incomplete.

In section 4.4.2 the spec for RenderbufferStorageEXT says that:
<internalformat> must be color-renderable, depth-renderable, or
stencil-renderable (as defined in section 4.4.4)

Then in section 4.4.4:
* The following base internal formats from table 3.15 are
"color-renderable": RGB, RGBA, FLOAT_R_NV, FLOAT_RG_NV,
FLOAT_RGB_NV, and FLOAT_RGBA_NV. The sized internal formats
from table 3.16 that have a color-renderable base internal
format are also color-renderable. No other formats, including
compressed internal formats, are color-renderable.

* An internal format is "depth-renderable" if it is
DEPTH_COMPONENT, or if it is one of the sized internal formats
from table 3.16 that has a depth-renderable base internal
format. No other formats are depth-renderable.

* An internal format is "stencil-renderable" if it is
STENCIL_INDEX, or if it is one of the sized internal formats
from table 2.nnn that has a stencil-renderable base internal
format. No other formats are stencil-renderable.

So, from that, at least the following members should be added. I have no idea where tabls 3.15 and 3.16 are, but the above text implies that there may be other formats on those tables that should be included too?

enum RenderbufferStorage
{
RGB, // I didn't look up the values for these
RGBA, 
FLOAT_R_NV, 
FLOAT_RG_NV,
FLOAT_RGB_NV,
FLOAT_RGBA_NV,
DEPTH_COMPONENT,
        StencilIndex1Ext = 36166,
        StencilIndex4Ext = 36167,
        StencilIndex8Ext = 36168,
        StencilIndex16Ext = 36169,
}
Inertia's picture

Thank you for pointing that out! I believe the tables are from http://www.opengl.org/registry/doc/glspec21.20061201.pdf

Table 3.15 basically shows that you cannot render to Intensity, Alpha or Luminance formats.

Depth formats from table 3.16:

sized internal: base internal:

DEPTH_COMPONENT16, DEPTH_COMPONENT
DEPTH_COMPONENT24, DEPTH_COMPONENT
DEPTH_COMPONENT32, DEPTH_COMPONENT

Color formats from table 3.16:

sized: base: bits:

R3G3B2, RGB 3 3 2
RGB4, RGB 4 4 4
RGB5, RGB 5 5 5
RGB8, RGB 8 8 8
RGB10, RGB 10 10 10
RGB12, RGB 12 12 12
RGB16, RGB 16 16 16
RGBA2, RGBA 2 2 2 2
RGBA4, RGBA 4 4 4 4
RGB5A1, RGBA 5 5 5 1
RGBA8, RGBA 8 8 8 8
RGB10A2, RGBA 10 10 10 2
RGBA12, RGBA 12 12 12 12
RGBA16, RGBA 16 16 16 16
SRGB8, RGB 8 8 8
SRGB8ALPHA8, RGBA 8 8 8 8

The real question is, how much of the OpenTK enum PixelInternalFormat is allowed here (obviously no Intensity, Alpha or Luminance). How about those sgi and other extension formats?