  type POINTFLOAT
    x as single
    y as single
  end type

  type GLYPHMETRICSFLOAT
    gmfBlackBoxX as single
    gmfBlackBoxY as single
    gmfptGlyphOrigin as POINTFLOAT
    gmfCellIncX as single
    gmfCellIncY as single
  end type

  ' Layer plane descriptor
  '
  type LAYERPLANEDESCRIPTOR
    nSize as word
    nVersion as word
    dwFlags as dword
    iPixelType as byte
    cColorBits as byte
    cRedBits as byte
    cRedShift as byte
    cGreenBits as byte
    cGreenShift as byte
    cBlueBits as byte
    cBlueShift as byte
    cAlphaBits as byte
    cAlphaShift as byte
    cAccumBits as byte
    cAccumRedBits as byte
    cAccumGreenBits as byte
    cAccumBlueBits as byte
    cAccumAlphaBits as byte
    cDepthBits as byte
    cStencilBits as byte
    cAuxBuffers as byte
    iLayerPlane as byte
    bReserved as byte
    crTransparent as dword
  end type

  type WGLSWAP
    hdc as sys
    uiFlags as dword
  end type

  %WGL_FONT_LINES    = 0
  %WGL_FONT_POLYGONS = 1

  ' LAYERPLANEDESCRIPTOR flags
  %LPD_DOUBLEBUFFER   &H00000001
  %LPD_STEREO         &H00000002
  %LPD_SUPPORT_GDI    &H00000010
  %LPD_SUPPORT_OPENGL &H00000020
  %LPD_SHARE_DEPTH    &H00000040
  %LPD_SHARE_STENCIL  &H00000080
  %LPD_SHARE_ACCUM    &H00000100
  %LPD_SWAP_EXCHANGE  &H00000200
  %LPD_SWAP_COPY      &H00000400
  %LPD_TRANSPARENT    &H00001000

  %LPD_TYPE_RGBA       0
  %LPD_TYPE_COLORINDEX 1

  ' wglSwapLayerBuffers flags
  '
  %WGL_SWAP_MAIN_PLANE &H00000001
  %WGL_SWAP_OVERLAY1   &H00000002
  %WGL_SWAP_OVERLAY2   &H00000004
  %WGL_SWAP_OVERLAY3   &H00000008
  %WGL_SWAP_OVERLAY4   &H00000010
  %WGL_SWAP_OVERLAY5   &H00000020
  %WGL_SWAP_OVERLAY6   &H00000040
  %WGL_SWAP_OVERLAY7   &H00000080
  %WGL_SWAP_OVERLAY8   &H00000100
  %WGL_SWAP_OVERLAY9   &H00000200
  %WGL_SWAP_OVERLAY10  &H00000400
  %WGL_SWAP_OVERLAY11  &H00000800
  %WGL_SWAP_OVERLAY12  &H00001000
  %WGL_SWAP_OVERLAY13  &H00002000
  %WGL_SWAP_OVERLAY14  &H00004000
  %WGL_SWAP_OVERLAY15  &H00008000
  %WGL_SWAP_UNDERLAY1  &H00010000
  %WGL_SWAP_UNDERLAY2  &H00020000
  %WGL_SWAP_UNDERLAY3  &H00040000
  %WGL_SWAP_UNDERLAY4  &H00080000
  %WGL_SWAP_UNDERLAY5  &H00100000
  %WGL_SWAP_UNDERLAY6  &H00200000
  %WGL_SWAP_UNDERLAY7  &H00400000
  %WGL_SWAP_UNDERLAY8  &H00800000
  %WGL_SWAP_UNDERLAY9  &H01000000
  %WGL_SWAP_UNDERLAY10 &H02000000
  %WGL_SWAP_UNDERLAY11 &H04000000
  %WGL_SWAP_UNDERLAY12 &H08000000
  %WGL_SWAP_UNDERLAY13 &H10000000
  %WGL_SWAP_UNDERLAY14 &H20000000
  %WGL_SWAP_UNDERLAY15 &H40000000

  %WGL_SWAPMULTIPLE_MAX = 16

  extern lib "opengl32.dll"

  sys wglCopyContext            (sys hglrcSrc, sys hlglrcDst, sys dMask)
  sys wglCreateContext          (sys hdc)
  sys wglCreateLayerContext     (sys hdc, sys iLayerPlane)
  sys wglDeleteContext          (sys hglrc)
  sys wglGetCurrentContext      (void)
  sys wglGetCurrentDC           (void)
  sys wglGetProcAddress         (zstring*lpszProc)
  sys wglMakeCurrent            (sys hdc, sys hglrc)
  sys wglShareLists             (sys hglrc1, sys hglrc2)
  sys wglUseFontBitmapsA        (sys hdc, sys dFirst, sys dCount, sys dListBase)
  sys wglUseFontOutlinesA       (sys hdc, sys dFirst, sys dCount, sys dListBase, single deviation, single extrusion, sys iFormat, sys lpgmf)
  sys wglDescribeLayerPlane     (sys hdc, sys iPixelFormat, sys iLayerPlane, sys nBytes, LAYERPLANEDESCRIPTOR*plpd)
  sys wglSetLayerPaletteEntries (sys hdc, sys iLayerPlane, sys iStart, sys cEntries, sys*pcr)
  sys wglGetLayerPaletteEntries (sys hdc, sys iLayerPlane, sys iStart, sys cEntries,sys*pcr)
  sys wglRealizeLayerPalette    (sys hdc, sys iLayerPlane, sys fRealize)
  sys wglSwapLayerBuffers       (sys hdc, sys dfPlanes)
  bool wglUseFontBitmapsA       (sys hdc, sys first ,sys count, sys listbase)
  bool wglUseFontBitmapsW       (sys hdc, sys first ,sys count, sys listbase)

  end extern
