About GL_BLEND parameter

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

  1. those can be used by glEnable but can’t be used by glIsEnabled
    a. GL_MAP1_VERTEX_3
    b. GL_MAP1_VERTEX_4
    c. GL_RASTERIZER_DISCARD
    d. GL_SAMPLE_SHADING
  2. those can be used by glIsEnabled but can’t used by glEnable
    a. GL_COLOR_ARRAY
    b. GL_EDGE_FLAG_ARRAY
    c. GL_FOG_COORD_ARRAY
    d. GL_INDEX_ARRAY
    e. GL_SECONDARY_COLOR_ARRAY
    f. GL_VERTEX_ARRAY

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

  1. those can be used by glEnable but can’t used by glGetBooleanv
    a. GL_DEBUG_OUTPUT
    b. GL_DEBUG_OUTPUT_SYNCHRONOUS
    c. GL_DEPTH_CLAMP
    d. GL_FRAMEBUFFER_SRGB
    e. GL_MULTISAMPLE
    f. GL_PRIMITIVE_RESTART
    g. GL_PRIMITIVE_RESTART_FIXED_INDEX
    h. GL_RASTERIZER_DISCARD
    i. GL_SAMPLE_ALPHA_TO_COVERAGE
    j. GL_SAMPLE_ALPHA_TO_ONE
    k. GL_SAMPLE_COVERAGE
    l. GL_SAMPLE_SHADING
    m. GL_SAMPLE_MASK
    n. GL_TEXTURE_CUBE_MAP_SEAMLESS

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
1 Like

Yes. It actually can be queried by glGetBooleanv but absent from the reference page.