Extensions

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1715
Joined: Sat Feb 23, 2008 11:15 pm

Extensions

Post by Kjell » Tue May 31, 2011 2:04 pm

:!:

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

Post Reply