GLGETTRANSFORMFEEDBA(3G)

🌸 GLGETTRANSFORMFEEDBA(3G) 🌸

okay bestie so real talk β€” this one is from the 3G manual (the OpenGL family of pages, iykyk), and it's basically the "hey what's going on with my transform feedback rn" page. it's all about querying state, not setting it. no cap, it's giving investigator energy πŸ”πŸ’…


✨ NAME ✨

glGetTransformFeedbackiv β€” literally just: query the state of a transform feedback object. that's it, that's the whole vibe 🫢


✨ C SPECIFICATION ✨

here's the exact tea, copy it character for character bestie:

void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);

void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index,
                               GLint *param);

void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index,
                                 GLint64 *param);

three (3) separate divas, all serving the same general purpose 😭


πŸŽ€ PARAMETERS πŸŽ€

  • xfb β€” the name of an existing transform feedback object ✨ or zero, which means the default transform feedback object (the fallback bestie, we respect her).
  • pname β€” which property you're querying. must be one of these, no substitutions allowed: GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, GL_TRANSFORM_FEEDBACK_BUFFER_START, GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, GL_TRANSFORM_FEEDBACK_PAUSED, GL_TRANSFORM_FEEDBACK_ACTIVE.
  • index β€” the index of the transform feedback stream (this is for the indexed state, the fancy stuff πŸ’…).
  • param β€” the address of a buffer where the requested state info gets written. it's an output, so keep your eyes on it πŸ‘€

πŸ¦‹ DESCRIPTION πŸ¦‹

so. to actually use Transform Feedback, you gotta configure the Transform Feedback Buffer indexed bindings first. and there are two ways to do that, both iconic:

  1. use glBindBufferBase or glBindBuffersBase to associate whole buffer object storage with one of the Transform Feedback Binding Points, or
  2. call glBindBufferRange or glBindBuffersRange to use just a region of a buffer object's storage for the binding.

you also may want to β€” but are not required to β€” bind a Transform Feedback Object first, in order to cache the binding configuration. why would you? because it usually lets you restore the TF configuration faster than if you had to execute a whole list of API calls just to set up the Transform Feedback state of your liking. it's the "save your progress" of GL, fr fr πŸ’Ύβœ¨

now this reference page discusses two types of getters that operate on Transform Feedback Objects and their bindings. two flavors, one obsession πŸ“

πŸ’œ class one: the general binding point girlies

the first class operates on the general Transform Feedback binding point and includes the glGetTransformFeedbackiv function. glGetTransformFeedbackiv can be used to retrieve info about the Transform Feedback object bound to the general Transform Feedback binding point, as configured with a glBindTransformFeedback call. in this case you can check:

  • what the ID of the currently bound Transform Feedback Object is β€” (GL_TRANSFORM_FEEDBACK_BUFFER_BINDING)
  • whether the Transform Feedback process is currently paused β€” (GL_TRANSFORM_FEEDBACK_PAUSED)
  • whether the Transform Feedback process has been begun and is currently undergoing β€” (GL_TRANSFORM_FEEDBACK_ACTIVE)

πŸ’œ class two: the per-binding investigative squad

the latter class β€” which includes glGetTransformFeedbacki_v and glGetTransformFeedbacki64_v β€” can be used to check what the current configuration of each of the buffer object regions bound to Transform Feedback Buffer binding points is. this lets you query for the following info:

  • glGetTransformFeedbacki_v only: what the ID of the Buffer Object bound to a Transform Feedback Binding Point of user-specified index is β€” (GL_TRANSFORM_FEEDBACK_BUFFER_BINDING)
  • glGetTransformFeedbacki64_v only: what the start offset configured for the binding is β€” (GL_TRANSFORM_FEEDBACK_BUFFER_START)
  • glGetTransformFeedbacki64_v only: what the length of the region used for the binding is β€” (GL_TRANSFORM_FEEDBACK_BUFFER_SIZE)

πŸ”₯ ERRORS πŸ”₯

bestie, this is the part where GL gets EXTREMELY loud at you. read carefully, these are the vibes it will throw:

  • GL_INVALID_OPERATION is generated if xfb is not zero or the name of an existing transform feedback object. (so, like, don't make up names. she will know. πŸ’€)
  • GL_INVALID_ENUM is generated by glGetTransformFeedbackiv if pname is not GL_TRANSFORM_FEEDBACK_PAUSED or GL_TRANSFORM_FEEDBACK_ACTIVE.
  • GL_INVALID_ENUM is generated by glGetTransformFeedbacki_v if pname is not GL_TRANSFORM_FEEDBACK_BUFFER_BINDING.
  • GL_INVALID_ENUM is generated by glGetTransformFeedbacki64_v if pname is not GL_TRANSFORM_FEEDBACK_BUFFER_START or GL_TRANSFORM_FEEDBACK_BUFFER_SIZE.
  • GL_INVALID_VALUE is generated by glGetTransformFeedbacki_v and glGetTransformFeedbacki64_v if index is greater than or equal to the number of binding points for transform feedback (which is the value of GL_MAX_TRANSFORM_FEEDBACK_BUFFERS). 😭
ngl every single one of these is a "wrong dial, try again" situation. pick the right pname for the right function or the error generator is gonna eat you alive.

⭐ VERSION SUPPORT ⭐

okay the original had this whole giant grid (a table, which we do not do here, so we're serving it as a list instead β€” same facts, more personality πŸ’…). the columns are OpenGL versions 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5. every function below is a whole lot of "nope" until 4.5, which is a big fat yes:

  • glGetTransformFeedbackiv β€” 2.0: -, 2.1: -, 3.0: -, 3.1: -, 3.2: -, 3.3: -, 4.0: -, 4.1: -, 4.2: -, 4.3: -, 4.4: -, 4.5: βœ”
  • glGetTransformFeedbacki_v β€” 2.0: -, 2.1: -, 3.0: -, 3.1: -, 3.2: -, 3.3: -, 4.0: -, 4.1: -, 4.2: -, 4.3: -, 4.4: -, 4.5: βœ”
  • glGetTransformFeedbacki64v β€” 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 yes, the version support table spells the third one glGetTransformFeedbacki64v without the underscore while the C spec says glGetTransformFeedbacki64_v β€” that's exactly how the original rolls it, so we're preserving the chaos 🫠)


🌈 SEE ALSO 🌈

go read these next, they're the friend group:

  • glBindBufferBase()
  • glBindBufferRange()
  • glBindBuffersBase()
  • glBindBuffersRange()
  • glBindTransformFeedback()

Copyright Β© 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 Β© 2014 Khronos Group


🧚 sign-off time 🧚 and that's the page bestie!! it came from [FIXME: source], dated 08/09/2021, and it lives at GLGETTRANSFORMFEEDBA(3G) in the [FIXME: manual]. go forth and query your transform feedback state correctly, you absolute icon πŸ’…βœ¨πŸŒΈ
πŸ“¦ where this page comes from