GLAF
OpenGL Advanced Functionality
 

News   What is?   Pros and Cons  Motivation Features  Basic Use  Platforms Take Care!  To Do   Download


Basic HowTo
  • Each OpenGL context in your application will need a GLAF context for it.
  • Declare as many GLint variables as contexts you have, for storing the ID of each GLAF context.
  • After creating each OpenGL context, call glaf_InitializeContext() in order to create (and initialize) the GLAF context that belongs to the OpenGL context. This call has some overhead because GLAF will check for feature availability, guess the best way of accessing features depending on the OpenGL version and the extensions string, and cache the pointers to functions if the feature needs functions (some features are enumerant-based only).
  • Of course, the OpenGL context must be current before you call glaf_InitializeContext().
  • Store the return value of glaf_InitializeContext() in the proper GLint ID.
  • If you want verbose messages of GLAF context initialization, register a verbose callback with glaf_SetVerbose() before you call glaf_InitializeContext(). Otherwise, the initialization will be silent.
  • If your application has more than one context, call glaf_ReadyForContext(id) after making a context current, and before you call any other GLAF functions in the context. This function is very fast (just updating a global pointer to point to the current context structure). If your application has just one context, you don't need to call glaf_ReadyForContext(id), because glaf_InitializeContext() implies glaf_ReadyForContext(id).
  • If your application needs to destroy contexts at runtime, call glaf_FreeContext(id) for such purpose.
  • And that's all about contexts' management.


Use of features

  • For a given feature XXXXX, call glaf_IsXXXXXSupported() for determining availability. These functions are also very fast, because they just return a cached result, so you can afford to call them from your rendering loop.
  • Functions (if any) for feature XXXXX match those of the original API. If you'll use GLAF names, just substitute the 'gl' preffix by 'glaf_' and eliminate any extensions suffixes if they exist. If you'll use OpenGL names, use core-naming (not extension-naming). Anyway, read the GLAF features documentation, because some features may need additional considerations.
  • About enumerants  (if any) for feature XXXXX, you can use the original enumerants from your OpenGL include files if you wish. Alternatively, you can use GLAF enumerants (just substitute the 'GL_' preffix by 'GLAF_' and eliminate any extension suffixes). These GLAF enumerants are defined numerically, so you can compile with support of advanced features even if your OpenGL include files are outdated. Apart from compilation compatibility, the choice doesn't matter, since both GLAF and GL enumerants contain the same value.

News   What is?   Pros and Cons  Motivation Features  Basic Use  Platforms Take Care!  To Do   Download

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