It seems I can get the value of GL_BLEND
by
glIsEnabled
or by
glGetBooleanv
are they the same?
It seems I can get the value of GL_BLEND
by
glIsEnabled
or by
glGetBooleanv
are they the same?
Yes. AFAIK, any boolean state can be queried with glGetBooleanv
, while only state which is set with glEnable
or glDisable
can be queried with glIsEnabled
. The syntax of the latter (using a return value rather than a passed-in pointer) is typically more convenient.
But it should rarely be necessary to query enable state. Your program should already know if the feature is enabled or not.
Historically, use of glGet*
(or glIsEnabled
) had a significant performance cost so you would avoid using it wherever possible. That’s probably less of an issue now that indirect rendering has effectively been eliminated.
From the merged glEnable
(4.x and 2.1) and glIsEnabled
(4.x and 2.1) most parameters of glEnable
and glIsEnabled
are matched, there are few exceptions
glEnable
but can’t be used by glIsEnabled
glIsEnabled
but can’t used by glEnable
From the merged glEnable
(4.x and 2.1) and glGetBooleanv
(4.x and 2.1) most parameters of glEnable
and glGetBooleanv
are matched, there are few exceptions
glEnable
but can’t used by glGetBooleanv
The online reference pages aren’t definitive. It’s entirely possible that there are omissions. E.g. for GL_SAMPLE_SHADING
, table 23.11 (in the 4.6 specifications) states that the get command is glIsEnabled
, so its absence from the online reference page is an oversight.
Also, the first paragraph of Chapter 23 (State Tables) is
So any state that can be queried with glIsEnabled
can be queried with glGet*
(although the converse isn’t true), and omission from the glGet*
reference page is an oversight.
The state variables for which the get command is given as glGetBooleanv
or glGetBooleani_v
are
GL_SAMPLE_COVERAGE_INVERT
GL_COLOR_WRITEMASK
GL_DEPTH_WRITEMASK
GL_UNPACK_SWAP_BYTES
GL_UNPACK_LSB_FIRST
GL_PACK_SWAP_BYTES
GL_PACK_LSB_FIRST
GL_IMAGE_BINDING_LAYERED
GL_TRANSFORM_FEEDBACK_PAUSED
GL_TRANSFORM_FEEDBACK_ACTIVE
GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED
GL_SHADER_COMPILER
GL_DOUBLEBUFFER
GL_STEREO
Yes. It actually can be queried by glGetBooleanv
but absent from the reference page.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.