在 OpenGL / WebGL 中哪些功能与哪些目标相匹配?

Which functions go with which targets in OpenGL / WebGL?

如果我对这个问题的措辞不当,我深表歉意。

是否可以在任何地方找到 OpenGL/WebGL 函数 以及它们关联的 目标 的列表?例如,为了调用 glDrawElements(),必须将缓冲区绑定到 GL_ELEMENT_ARRAY_BUFFER 目标。并且要调用 glBufferData(),缓冲区必须绑定到多个目标之一,包括 GL_ARRAY_BUFFERGL_ELEMENT_ARRAY_BUFFERGL_UNIFORM_BUFFER 等...

解决这个问题的另一种方法是,是否有 目标 及其启用的功能的列表?

我已经下载了 OpenGL 3.0 ES 文档文件,我非常有信心其中包含我需要的所有信息。但它分布在 ~280 个文件中,我知道我会错过很多实例。我一定是忽略了一些东西,因为在试图掌握“目标”的概念时,这似乎是 OpenGL 的一个重要方面。

等待一段时间后,我决定使用递归 grep 参考手册中得到的信息提交我自己问题的答案。

这一定是部分列表。大概是有些失误。如果您发现任何遗漏或错误,请随时编辑和更正。

如果有人能提交更好、更准确的答案,我将很乐意接受并表示感谢。

目标函数:

Target Functions
ARRAY_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter, vertexAttribPointer
COPY_READ_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter
COPY_WRITE_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter
ELEMENT_ARRAY_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter, drawElements, drawElementsInstanced, drawRangeElements
PIXEL_PACK_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter, readPixels
PIXEL_UNPACK_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter, compressedTexImage2D, compressedTexImage3D, compressedTexSubImage2D, compressedTexSubImage3D, texImage2D, texImage3D, texSubImage2D, texSubImage3D
TRANSFORM_FEEDBACK_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter, bindBufferBase, bindBufferRange
UNIFORM_BUFFER bindBuffer, bufferData, bufferSubData, copyBufferSubData, getBufferParameter, bindBufferBase, bindBufferRange
TEXTURE_2D compressedTexImage2D, compressedTexSubImage2D, texImage2D, texSubImage2D, framebufferTexture2D, bindTexture, copyTexImage2D, copyTexSubImage2D, generateMipmap, getTexParameter, texStorage2D
TEXTURE_3D compressedTexImage3D, compressedTexSubImage3D, texImage3D, texSubImage3D, bindTexture, generateMipmap, getTexParameter, copyTexSubImage3D, texStorage3D
TEXTURE_2D_ARRAY compressedTexImage3D, compressedTexSubImage3D, texImage3D, texSubImage3D, bindTexture, generateMipmap, getTexParameter, copyTexSubImage3D, texStorage3D
TEXTURE_CUBE_MAP texImage2D, bindTexture, generateMipmap, getTexParameter, texStorage2D
GL_FRAMEBUFFER framebufferTexture2D
READ_FRAMEBUFFER framebufferTexture2D, bindFramebuffer, checkFramebufferStatus, framebufferRenderbuffer, framebufferTextureLayer, invalidateFramebuffer, invalidateSubFramebuffer
DRAW_FRAMEBUFFER framebufferTexture2D, bindFramebuffer, checkFramebufferStatus, framebufferRenderbuffer, framebufferTextureLayer, invalidateFramebuffer, invalidateSubFramebuffer
RENDERBUFFER framebufferRenderbuffer, bindRenderbuffer, renderbufferStorage, renderbufferStorageMultisample
TRANSFORM_FEEDBACK bindTransformFeedback

按功能定位

Function Targets
bindBuffer ARRAY_BUFFER, COPY_READ_BUFFER, COPY_WRITE_BUFFER, ELEMENT_ARRAY_BUFFER, PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER, TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
bindBufferBase TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
bindBufferRange TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
bindFramebuffer READ_FRAMEBUFFER, DRAW_FRAMEBUFFER
bindRenderbuffer RENDERBUFFER
bindTexture TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP
bindTransformFeedback TRANSFORM_FEEDBACK
bufferData ARRAY_BUFFER, COPY_READ_BUFFER, COPY_WRITE_BUFFER, ELEMENT_ARRAY_BUFFER, PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER, TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
bufferSubData ARRAY_BUFFER, COPY_READ_BUFFER, COPY_WRITE_BUFFER, ELEMENT_ARRAY_BUFFER, PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER, TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
checkFramebufferStatus READ_FRAMEBUFFER, DRAW_FRAMEBUFFER
compressedTexImage2D PIXEL_UNPACK_BUFFER, TEXTURE_2D
compressedTexImage3D PIXEL_UNPACK_BUFFER, TEXTURE_3D, TEXTURE_2D_ARRAY
compressedTexSubImage2D PIXEL_UNPACK_BUFFER, TEXTURE_2D
compressedTexSubImage3D PIXEL_UNPACK_BUFFER, TEXTURE_3D, TEXTURE_2D_ARRAY
copyBufferSubData ARRAY_BUFFER, COPY_READ_BUFFER, COPY_WRITE_BUFFER, ELEMENT_ARRAY_BUFFER, PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER, TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
copyTexImage2D TEXTURE_2D
copyTexSubImage2D TEXTURE_2D
copyTexSubImage3D TEXTURE_3D, TEXTURE_2D_ARRAY
drawElements ELEMENT_ARRAY_BUFFER
drawElementsInstanced ELEMENT_ARRAY_BUFFER
drawRangeElements ELEMENT_ARRAY_BUFFER
framebufferRenderbuffer READ_FRAMEBUFFER, DRAW_FRAMEBUFFER, RENDERBUFFER
framebufferTexture2D GL_FRAMEBUFFER, READ_FRAMEBUFFER, DRAW_FRAMEBUFFER, TEXTURE_2D
framebufferTextureLayer READ_FRAMEBUFFER, DRAW_FRAMEBUFFER
generateMipmap TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP
getBufferParameter ARRAY_BUFFER, COPY_READ_BUFFER, COPY_WRITE_BUFFER, ELEMENT_ARRAY_BUFFER, PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER, TRANSFORM_FEEDBACK_BUFFER, UNIFORM_BUFFER
getTexParameter TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP
invalidateFramebuffer READ_FRAMEBUFFER, DRAW_FRAMEBUFFER
invalidateSubFramebuffer READ_FRAMEBUFFER, DRAW_FRAMEBUFFER
readPixels PIXEL_PACK_BUFFER
renderbufferStorage RENDERBUFFER
renderbufferStorageMultisample RENDERBUFFER
texImage2D PIXEL_UNPACK_BUFFER, TEXTURE_2D, TEXTURE_CUBE_MAP
texImage3D PIXEL_UNPACK_BUFFER, TEXTURE_3D, TEXTURE_2D_ARRAY
texStorage2D TEXTURE_2D, TEXTURE_CUBE_MAP
texStorage3D TEXTURE_3D, TEXTURE_2D_ARRAY
texSubImage2D PIXEL_UNPACK_BUFFER, TEXTURE_2D
texSubImage3D PIXEL_UNPACK_BUFFER, TEXTURE_3D, TEXTURE_2D_ARRAY
vertexAttribPointer ARRAY_BUFFER

最后,这些是您调用的所有不需要目标作为参数的函数(即如果您没有将某个对象绑定到某个目标就会抛出的函数):

  • vertexAttribPointer
  • 绘图元素
  • drawElementsInstanced
  • drawRangeElements
  • 读取像素