Why do glBindRenderbuffer and glRenderbufferStorage each take a “target” parameter?
It takes a target parameter, but the only viable target is
GL_RENDERBUFFER?.
http://www.opengl.org/wiki/Renderbuffer_Object
https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBindRenderbuffer.xml
http://www.opengl.org/wiki/GlRenderbufferStorage
(我只是在学习OpenGL,并且今天已经找到了这两个;也许我可以期望这个看似无用的目标参数在许多函数中很常见?)
原始
(30) Do the calls to deal with renderbuffers need a target
parameter? It seems unlikely this will be used for anything.RESOLUTION: resolved, yes
Whether we call it a"target" or not, there is some piece
of state in the context to hold the current renderbuffer
binding. This is required so that we can call routines like
RenderbufferStorage and {Get}RenderbufferParameter() without
passing in an object name. It is also possible we may
decide to use the renderbuffer target parameter to
distinguish between multisample and non multisample buffers.
Given those reasons, the precedent of texture objects, and
the possibility we may come up with some other renderbuffer
target types in the future, it seems prudent and not all
that costly to just include the target type now.
通常情况下,核心OpenGL仅为某些参数定义一个合法值,而扩展则添加其他值。 不管今天的扩展中是否定义了更多的值,建筑师显然都希望为将来的扩展打开一扇门。