GLAF
OpenGL Advanced Functionality

Back to documentation index


Polygon Offset availability test

GLboolean glaf_IsPolygonOffsetSupported(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.
 

Polygon Offset support rules

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


Polygon Offset enumerants

(Add either a 'GLAF_' or 'GL_' prefix before each enumerant. GLAF enumerants are always defined, while GL ones depend on the version of your include files).

POLYGON_OFFSET   (for glEnable/glDisable)
 

Polygon Offset functions

glaf_PolygonOffset     

Beware! Only the GL_FILL mode is supported by GLAF, because there's no way of supporting other modes in OpenGL1.0.

Note: The arguments' meaning is always the one of the core 1.1 polygon offset feature. If we're running in OpenGL 1.0, GLAF will silently do a conversion of the bias argument. This conversion is tricky and it's not guaranteed to always give good results, because the actual significant bits of the depth buffer may not match the value returned by glGet. For getting the "Z effective unit", GLAF will discard 4 bits of the depth buffer. This may sound a bit exaggerated, but it's what SGI implicitly recommends in the glPolygonOffsetEXT manpage (ie: using 1/2**16 for 20bit Z-buffers and 1/2**20 for 24bit Z-buffers).
 

Polygon Offset definitions in 'gl2glaf.h' (optional)

#define glPolygonOffset                 glaf_PolygonOffset
 

Polygon Offset side effects

None.
 

Back to documentation index
 

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