procedure TForm1.FormCreate(Sender: TObject);
var
pfd: TPixelFormatDescriptor;
FormatIndex: integer;
begin
fillchar(pfd, SizeOf(pfd),0);
with pfd do
begin
nSize := sizeOf(pfd);
nVersion := 1;
dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL;
iPixelType := PFD_TYPE_RGBA;
cColorBits := 24;
cDepthBits := 32;
iLayerType := PFD_MAIN_PLANE;
end;{with}
FormatIndex := ChoosePixelFormat(Form1.Canvas.Handle,@pfd);
if (FormatIndex=0) then MessageDlg('Error1',mtInformation,[mbOK], 0);
SetPixelFormat(Form1.Canvas.Handle,FormatIndex, @pfd);
GLContext := wglCreateContext(Form1.Canvas.Handle);
if (GLContext=0) then MessageDlg('Error2'mtInformation,[mbOK],0);