determining supported extensions

I got some code from that checked for extensions. It’s failing, coming back with NULL from the gl call:

extensions = glGetString( GL_EXTENSIONS );

Is there something obviously wrong? I am running Linux, and installed the latest NVIDIA drivers. I have a 6600 card, which should support VBO, and supposedly the driver should be 2.0

I guess, in priority order, I would like to know:

  1. What I have to do to get this code to work.
  2. For the future, how to identify the version of the OpenGL I am working with.

The files that were installed by the NVIDIA driver do not contain comments more recent than OpenGL14, but this is hardly proof. In any case, the ARB stuff is at least that old, and ought to work even in 1.4


  bool Viewer::isExtensionSupported(const char extensionName[] ) const {
    if (extensionName == NULL) return false; // no pointer
    if (*extensionName == '\0') return false; // empty string

    const unsigned char *extensions = NULL;
    const unsigned char *start;
    unsigned char *terminator;

    unsigned char* where = (unsigned char *) strchr( extensionName, ' ' );
    if( where != NULL) return false;  // Extension names should not have spaces

    // Get Extensions String
    extensions = glGetString( GL_EXTENSIONS );
    if (extensions == NULL) return false; // can't find extensions?
    cout << "EXTENSIONS: " << extensions << "
    // Search The Extensions String For An Exact Copy

You must have already initialized OpenGL context before any call to OpenGL API. On Windows it means creating rendering context with wglCreateCreateContext and making it active with wglMakeCurrent. On Linux it is very similar, but I don’t know exact functions for that.

Thanks so much! That makes perfect sense. I’ll make sure I’m calling it a bit later.