Page 1 of 1

Extensions

Posted: Tue May 31, 2011 2:04 pm
by Kjell
:!:

Function to detect if a OpenGL Extension is supported by the machine your application is running on.

Code: Select all

int extension(string D)
{
  int    L, N;
  string E, S;

  E = "";
  S = glGetString(0x1F03);

  L = length(S);
  N = 0;

  while(N < L)
  {
    string C = subStr(S,N,1);

    if(C == " ")
    {
      if(E == D)return 1;
      E = "";
    }
    else E += C;

    N++;
  }

  return 0;
}
Can be called by using for example ..

Code: Select all

int FBO = extension("GL_EXT_framebuffer_object");
Requires "opengl32.dll" function "string glGetString(int Name){}".

K