unit unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
OpenGLContext, GL, GLU;
type
{ TForm1 }
TForm1 =
class(TForm)
OpenGLControl1: TOpenGLControl;
procedure OpenGLControl1Paint(Sender: TObject);
procedure OpenGLControl1Resize(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.OpenGLControl1Paint(Sender: TObject);
begin
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT
or GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, Double(OpenGLControl1.Width) / OpenGLControl1.Height, 0.1, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0); glVertex3f(0, 1, 0);
glColor3f(0, 1, 0); glVertex3f(-1, 0, 0);
glColor3f(0, 0, 1); glVertex3f(1, 0, 0);
glEnd();
OpenGLControl1.SwapBuffers;
end;
procedure TForm1.OpenGLControl1Resize(Sender: TObject);
begin
end;
initialization
{$I unit1.lrs}
end.