GLRENDERBUFFERSTORAG(3G)

πŸ’– GLRENDERBUFFERSTORAG(3G) πŸ’–

okay so this is from the 3G manual section, and it's literally the whole glow-up guide for glRenderbufferStorageMultisample and glNamedRenderbufferStorageMultisample β€” two functions that set up the storage, format, dimensions and sample count for a renderbuffer object's image. bestie, this is the "give your renderbuffer a body" page. let's get into it 🫢


✨ NAME ✨

glRenderbufferStorageMultisample, glNamedRenderbufferStorageMultisample β€” establish data storage, format, dimensions and sample count of a renderbuffer object's image πŸ’…


🌸 C SPECIFICATION 🌸

look at these signatures, they ate:

void glRenderbufferStorageMultisample(GLenum target, GLsizei samples,
                                      GLenum internalformat,
                                      GLsizei width, GLsizei height);

void glNamedRenderbufferStorageMultisample(GLuint renderbuffer,
                                           GLsizei samples,
                                           GLenum internalformat,
                                           GLsizei width,
                                           GLsizei height);

πŸŽ€ PARAMETERS πŸŽ€

  • target β€” this is the binding target of the allocation for the glRenderbufferStorageMultisample function. it must be GL_RENDERBUFFER, no cap, that's the only vibe allowed here ✨
  • renderbuffer β€” the name of the renderbuffer object, for the glNamedRenderbufferStorageMultisample function. this is the DSA version's way of saying "this one right here, by name" 🫢
  • samples β€” how many samples you want used for the renderbuffer object's storage. the more the merrier (until the caps say otherwise, we'll get there) 🌈
  • internalformat β€” the internal format to use for the renderbuffer object's image. this is the personality of the storage, basically πŸ’œ
  • width β€” the width of the renderbuffer, in pixels πŸ“
  • height β€” the height of the renderbuffer, in pixels πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

so glRenderbufferStorageMultisample and glNamedRenderbufferStorageMultisample establish the data storage, format, dimensions and number of samples of a renderbuffer object's image. all four things at once, icon behavior honestly πŸ‘‘

for glRenderbufferStorageMultisample, the target of the operation β€” that's the target param β€” must be GL_RENDERBUFFER. that's non-negotiable bestie. for glNamedRenderbufferStorageMultisample, renderbuffer must be an ID of an existing renderbuffer object (like, an actual one that exists, not a made-up name, we'll get to that in ERRORS and it's giving πŸ’€).

internalformat specifies the internal format to be used for the renderbuffer object's storage, and it must be a color-renderable, depth-renderable, or stencil-renderable format. one of those three, pick a lane.

width and height are the dimensions, in pixels, of the renderbuffer. both width and height must be less than or equal to the value of GL_MAX_RENDERBUFFER_SIZE. do not test that limit, it will not go well for u 😭

samples specifies the number of samples to be used for the renderbuffer object's image, and it must be less than or equal to the value of GL_MAX_SAMPLES. and here's the spicy caveat β€” if internalformat is a signed or unsigned integer format then samples must be less than or equal to the value of GL_MAX_INTEGER_SAMPLES. integer formats get their own, smaller ceiling. iykyk πŸ”₯

⚠️ okay this part is important: upon success, glRenderbufferStorageMultisample and glNamedRenderbufferStorageMultisample delete any existing data store for the renderbuffer image, and the contents of the data store after calling either of the functions are undefined. undefined!! not zeroed, not preserved, not "probably fine" β€” undefined. so don't be out here reading old pixels and expecting them to still be there πŸ™ˆ

πŸ’€ ERRORS πŸ’€

every way to get yelled at, listed out:

  • GL_INVALID_ENUM is generated by the glRenderbufferStorageMultisample function if target is not GL_RENDERBUFFER.
  • GL_INVALID_OPERATION is generated by the glNamedRenderbufferStorageMultisample function if renderbuffer is not the name of an existing renderbuffer object.
  • GL_INVALID_OPERATION is generated if samples is greater than the maximum number of samples supported for internalformat.
  • GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or stencil-renderable format.
  • GL_INVALID_OPERATION is generated if internalformat is a signed or unsigned integer format and samples is greater than the value of GL_MAX_INTEGER_SAMPLES
  • GL_INVALID_VALUE is generated if either of width or height is negative, or greater than the value of GL_MAX_RENDERBUFFER_SIZE.
  • GL_OUT_OF_MEMORY is generated if the GL is unable to create a data store of the requested size. (the GL said "bestie, i simply cannot" 😭)

⭐ VERSION SUPPORT ⭐

the original puts this in a big grid, so here's the same tea in list form β€” every version, every checkmark, nothing skipped πŸ‘‘

the columns are OpenGL Version 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, and the cells are either - or βœ”:

  • glNamedRenderbufferStorageMultisample β€” 2.0: -, 2.1: -, 3.0: -, 3.1: -, 3.2: -, 3.3: -, 4.0: -, 4.1: -, 4.2: -, 4.3: -, 4.4: -, 4.5: βœ”
  • glRenderbufferStorageMultisample β€” 2.0: -, 2.1: -, 3.0: βœ”, 3.1: βœ”, 3.2: βœ”, 3.3: βœ”, 4.0: βœ”, 4.1: βœ”, 4.2: βœ”, 4.3: βœ”, 4.4: βœ”, 4.5: βœ”

so yeah, the named/DSA one is a 4.5-only king πŸ‘‘ and the classic one showed up in 3.0 and never left. main character energy since 3.0 fr fr πŸ’…


🌈 SEE ALSO 🌈

go read these next, they're all right there:

  • glGenRenderbuffers()
  • glBindRenderbuffer()
  • glNamedRenderbufferStorage
  • glRenderbufferStorage()
  • glFramebufferRenderbuffer()
  • glDeleteRenderbuffers()

Copyright Β© 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

Copyright Β© 2010-2014 Khronos Group


and that's the page bestie 🧚✨ tiny sign-off from the footer: the source is literally listed as [FIXME: source], the date on this one is 08/09/2021, and it goes out as GLRENDERBUFFERSTORAG(3G). go forth and allocate responsibly πŸ’–πŸ¦‹

πŸ“¦ where this page comes from