glIsEnabled
glIsEnabled is an OpenGL function used to query whether a specific capability is currently enabled in the active OpenGL context. It helps programs determine the current state of a feature without altering it.
GLboolean glIsEnabled(GLenum cap);
cap is a symbolic constant that identifies a capability. Valid values are the same enumerants accepted by
The function returns GL_TRUE if the specified capability is enabled, and GL_FALSE otherwise. The result reflects
glIsEnabled only reports the enabled/disabled state of a capability. It does not modify server state. It is
If (glIsEnabled(GL_DEPTH_TEST)) { /* depth testing is already on */ } else { glEnable(GL_DEPTH_TEST); }
glEnable, glDisable, and related capability enumerants. References to state queries in OpenGL specifications describe the error