unit Cyl1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  cOpenGL, Material, light, Transfrm, OpenGL;

type
  TForm1 = class(TForm)
    OpenGL1: TOpenGL;
    Transform1: TTransform;
    Light1: TLight;
    Transform2: TTransform;
    Material1: TMaterial;
    Material2: TMaterial;
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure Transform1Paint(Sender: TObject);
    procedure Transform2Paint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Shapes;

{$R *.DFM}

procedure TForm1.Transform1Paint(Sender: TObject);
begin
  Light1.Apply;
end;

procedure TForm1.Transform2Paint(Sender: TObject);
begin
  Material1.Apply;
  Material2.Apply;
  Cylinder;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  CylinderBase;
  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE);
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  if OpenGL1.Smaller then
    FormPaint(Sender);
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
  Transform1.Apply;
  Transform2.Apply;
  glFlush;
  OpenGL1.ErrorCheck('FormPaint');
end;

end.
  