PDA

View Full Version : Extensions wrapper...



Allan Walton
05-07-2003, 12:14 AM
Morning,

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 http://www.opengl.org/discussion_boards/ubb/smile.gif )

class X
{
X{}
~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?

Cheers,

Allan

Allan Walton
05-07-2003, 12:16 AM
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...

Cheers