Canvas.handle question related to OpenGL binding

I'm trying to use a Delphi OpenGL (the ready for 1.2 version by Mike
Lischke) binding, and am getting crashes when I try to use the OPENGL and
GLU DLLs
from SGI and Mesa.  I've been studying the problem, and it seems to be
related to the fact that Canvas.Handle returns different values from the
time a form gets created (in FormCreate) to when it gets resized (in
FormResize, which is visited after FormCreate), and when it has to be
repainted (in FormPaint).

According to the MSDN:

"The wglCreateContext function takes a device context handle as its
parameter and returns a rendering context handle. The created rendering
context is suitable for drawing on the device referenced by the device
context handle. In particular, its pixel format is the same as the device
contexts pixel format. After you create a rendering context, you can
release or dispose of the device context."

Note the last sentence.  I take this to mean that the an initial call to
wglCreateContext(Canvas.handle) in FormCreate will return a rendering
context that should also work for the other device contexes that
Canvas.handle returns later in the program.  This seems to be the case with
the Microsoft DLLs.  However, the SGI (MR-2) DLLs fail when the program
tries a SwapBuffer(Canvas.handle), while the Mesa (v2.6) DLLs crash when a
wglMakeCurrent(Canvas.handle,RC) follows a wglMakeCurrent(0,0).  In other
words, for the Mesa DLLs a second wglMakeCurrent(Canvas.Handle,RC) will
fail.  In Mesa's case this happened even when the Canvas.Handle and RC were
identical to the values in the first call.  i.e.

wglMakeCurrent(Canvas.Handle,RC);
wglMakeCurrent(0,0);
wglMakeCurrent(Canvas.Handle,RC);

with nothing in between fails!

In Mesa's case I managed to get the sample program supplied with the binding
to work, when I removed all wglMakeCurrent(0,0)s.  In the SGI DLLs case,
turning off double-buffering works (although it does make the animation
flicker.

From what I've seen so far it seems that the problem in Mesa's case is that
deactivating a current rendering context somehow fouls things up.  In SGIs
case,  it seems that there is something wrong in its implementation of
SwapBuffers.

The binding together with sample program can be found at:
http://sunsite.icm.edu.pl/delphi/ftp/d20free/opengl12.zip

I simply change the InitOpenGL call in the FormCreate to
InitOpenGLFromLibrary('MESAGL.DLL','MESAGLU.DLL') or
InitOpenGLFromLibrary('OPENGL.DLL','GLU.DLL') to call the corresponding
OpenGL implementation.  I put the DLLs in the Windows system directory.

Additionally for Mesa you need a fix for the binding in order for it not to
trip while parsing Mesa's version string.  Overwrite the corresponding code
in OPENGL.PAS in the ReadImplementationProperties procedure with the one
below:

  // determine version of implementation
  // -- first GL

  Buffer:=StrPas(PChar(glGetString(GL_VERSION)));
  // Remove anything after and including the first space in the version
string
  Separator:=Pos(' ',Buffer);
  Delete(Buffer,Separator,Length(Buffer)-Separator+1);
  Separator:=Pos('.',Buffer);
  if Separator = 0 then begin
    MinorVersion:=0;
    MajorVersion:=StrToInt(Buffer)
  end
  else begin
    MajorVersion:=StrToInt(Copy(Buffer,1,Separator-1));
    Delete(Buffer,1,Separator);
    Separator:=Pos('.',Buffer);
    if Separator = 0 then
      MinorVersion:=StrToInt(Buffer)
    else
      MinorVersion:=StrToInt(Copy(Buffer,1,Separator-1))
  end;
  GL_VERSION_1_0:=False;
  GL_VERSION_1_1:=False;
  GL_VERSION_1_2:=False;
  if MajorVersion > 0 then
  begin
    GL_VERSION_1_0:=True;
    if MinorVersion > 0 then
    begin
      GL_VERSION_1_1:=True;
      if MinorVersion > 1 then GL_VERSION_1_2:=True;
    end;
  end;
  // -- second GLU
  GLU_VERSION_1_1:=False;
  GLU_VERSION_1_2:=False;
  // gluGetString is valid for version 1.1 or later
  if assigned(gluGetString) then begin
    Buffer:=StrPas(PChar(gluGetString(GLU_VERSION)));
    // Remove anything after and including the first space in the version
string
    Separator:=Pos(' ',Buffer);
    Delete(Buffer,Separator,Length(Buffer)-Separator+1);
    Separator:=Pos('.',Buffer);
    if Separator = 0 then begin
      MinorVersion:=0;
      MajorVersion:=StrToInt(Buffer)
    end
    else begin
      MajorVersion:=StrToInt(Copy(Buffer,1,Separator-1));
      Delete(Buffer,1,Separator);
      Separator:=Pos('.',Buffer);
      if Separator = 0 then
        MinorVersion:=StrToInt(Buffer)
      else
        MinorVersion:=StrToInt(Copy(Buffer,1,Separator-1))
    end;
    if (MajorVersion > 0) and (MinorVersion > 0) then begin
      GLU_VERSION_1_1:=True;
      if MinorVersion > 1 then GLU_VERSION_1_2:=True;
    end;
  end;

  // check supported extensions
  // -- first GL