Extensions wrapper...


Has anyone got any suggestions for an extension system wrapper class?

i was messing around last night and got a quick solution but i’m not happy with it.

basically it was (used in conjunction with my singleton code) (not actually called X )

class X
bool IsExtensionAvailable(const char *pExtension)

    void ResolveExtensionFuncPtrs(void)
    LockFuncPtr GetLockArraysEXTFunc(void)
    UnLockFuncPtr GetUnlockArraysEXTFunc(void)


as you can see not very nice (and totally specific to the GL_EXT_compiled_vertex_array extension - but this is just an example)

Since the pointers are function pointers is it still considered poor coding practice to have globals?

Anybody have any ideas for a generic / tidier implementation?



Should have added that class X contained:

LockFuncPtr m_LockFuncPtr;
UnlockFuncPtr m_UnlockFuncPtr;

which are returned by the appropriate functions…

LockFuncPtr / UnlockFuncPtr are the typedefs in glext.h for the GL_EXT_compiled_vertex_array extension…