Sign in to follow this  
GosuDrew

glGetString(GL_EXTENSIONS)

Recommended Posts

Hi, This function is returning 0 and I don't understand why. I can't check now if certain functions are supported. Any ideas as to why this is happening? Also, is the way I'm parsing the buffer decent?
int main(int argc, char** argv)
{
   char extension[] = "GL_ARB_imaging";
   char *extensions_list = (char*) glGetString(GL_EXTENSIONS);

   if (!extensions_list)
      cout << "error" << endl;

   while (*extensions_list != '\0')
   {
      for (int i = 0; i < 14; i++)
      {
         if (extension[i] != *(extensions_list++))
         {
            while (*(extensions_list++) != ' ');
            break;
         }
      }
      if (i == 14 && (*extensions_list == ' ' ||
          *extensions_list == '\0'))
      {
         cout << "found!" << endl;
         break;
      }
   }

   return 0;
}

Share this post


Link to post
Share on other sites
Not sure if this is the case, but I believe you need to have an active OpenGL context available before any of the GL calls will be valid. From the looks of your code this is just a test program to see what OGL extensions are available so there is no OGL context. In order for your program to work I think you are going to need to create a window and get an OpenGL context for it before you can query the available extensions.

Hope this helps,
Dan

Share this post


Link to post
Share on other sites
I cut out the rest of the glut code that I had in the main function. I read on some post to change the class style to CS_OWNDC, however I'm using glut.

Nevermind I just put the code after all the initialization stuff and it works fine. I didn't know you needed the opengl device context setup before that call.

Thanks for the responses.

[Edited by - GosuDrew on July 10, 2005 11:58:10 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this