GLAF
OpenGL Advanced Functionality

Back to documentation index


RGBA LogicOp availability test

GLboolean glaf_IsRGBALogicOpSupported(void)

This function returns GL_TRUE if the feature is supported or GL_FALSE otherwise. Calling the functions of an unsupported feature or using its enumerants may crash the application, or generate OpenGL errors, or even undefined behaviour, so you should never use a feature without testing its availability first.
 

RGBA LogicOp support rules

  • If we're running in OpenGL 1.1 or higher, the core implementation is used.
  • Otherwise, if GL_EXT_blend_logic_op is supported, and the query of the address of the extension functions is successful, this extension is used.
  • Otherwise, the feature is unsupported.


RGBA LogicOp enumerants

None.
 

RGBA LogicOp functions

Beware!! GLAF doesn't provide an API analogous to the OpenGL color logicop API, because in OpenGL 1.0 the feature was available as a blending equation, so the way for enabling and disabling color logicop is quite different from 1.0 to newer versions.

Fortunately, the logicop mode is controlled, as always, with glLogicOp(), because it was also used for configuring the OpenGL 1.0 blending equation.

Of course, if you're confident that your application will always run in OpenGL 1.1 and higher, you can choose to directly use the core implementation instead of GLAF.

If you want to use this feature from GLAF, you've the following couple of functions for enabling and disabling the feature. Also, take a look at the 'side effects' section below, because these functions have side effects in the blending state. Don't forget that the logicop mode is controlled with glLogicOp().

void  glaf_EnableRGBALogicOp(void)
void  glaf_DisableRGBALogicOp(void)
 

RGBA LogicOp definitions in 'gl2glaf.h' (optional)

None.
 

RGBA LogicOp side effects

After calling glaf_DisableRGBALogicOp() blending will be disabled, and, if the blend equation feature is supported, the blend equation will be reset to FUNC_ADD. These side effects will always happen, no matter the OpenGL version and supported extensions. If the OpenGL version is 1.1 or greater, GL_COLOR_LOGIC_OP will be disabled as well.

Because these side effects will always happen, the application behaviour will be the same in all systems.

In OpenGL 1.0, GLAF uses blending for performing color logicop. Note that the OpenGL spec explicitly says that it's not possible to simultaneously enable color logicop and blending, so the GLAF approach shouldn't hurt too much, because you wouldn't be able to use blending even if you use the core logicop.

Back to documentation index
 

Copyright (C) 2001 César Blecua Udías