- procedure InitGL;
- var pfd: TPixelFormatDescriptor;
- begin
- FillChar(pfd, SizeOf(pfd), 0);
- pfd.nSize := SizeOf(pfd);
- pfd.nVersion := 1;
- pfd.dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER;
- pfd.iPixelType := PFD_TYPE_RGBA;
- pfd.cColorBits := 32;
- pfd.cDepthBits := 32;
- DC := GetDC(Form1.Handle);
- SetPixelFormat(DC, ChoosePixelFormat(DC, @pfd), @pfd);
- RC := wglCreateContext(DC);
- wglMakeCurrent(DC, RC);
- InitOpenGL;
- ActivateRenderingContext(DC, RC);
- end;