Статья: OpenGL и Delphi на практике
var pfd:TPixelFormatDescriptor;
nPixelFormat: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 or
PFD_DOUBLEBUFFER;
iPixelType:= PFD_TYPE_RGBA;
cColorBits:= 16;
cDepthBits:= 64;
iLayerType:= PFD_MAIN_PLANE;
end;
nPixelFormat:=ChoosePixelFormat(DC,@pfd);
SetPixelFormat(DC,nPixelFormat,@pfd);
end;
procedure TForm1.BeginPaint;
begin
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
timer1.enabled:=true;
end;
{$R *.dfm}