unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, StdCtrls, ExtCtrls, opengl;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure The_FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
hrc: HGLRC;
end;
var
Form1: TForm1;
x:double ;
y:double;
Fi:double;
implementation
{$R *.dfm}
procedure SetDCPixelFOrmat (hdc: HDC);
var pfd: TPixelFormatDescriptor;
nPixelFormat: integer;
begin
FillChar (pfd,SizeOf(pfd), 0);
nPixelFormat:=ChoosePixelFormat(hdc, @pfd);
SetPixelFormat(hdc, nPixelFormat, @pfd);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SetDCPixelFormat(Canvas.Handle);
hrc:=wglCreateContext(Canvas.Handle);
end;
procedure TForm1.The_FormPaint (Sender: TObject);
begin
wglMakeCurrent(Canvas.Handle, hrc);
{коло}
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glScaled(0.5, 1, 0.5);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_LINE_STIPPLE);
glColor3d(1, 0, 0);
glLineStipple(2, $FFFF);
glLineWidth(1);
glBegin(GL_LINE_LOOP);
Fi:=0;
while Fi<=2*Pi do begin
glVertex2d(cos(Fi), sin(Fi));
Fi:=Fi+Pi/100;
end;
glEnd;
{стрілки}
glColor3d(1, 1, 1);
glLineWidth(1);
glDisable(GL_LINE_STIPPLE);
glBegin(GL_LINES);
glVertex2d(1, 0);
glVertex2d(0.8, 0.1);
glVertex2d(1, 0);
glVertex2d(0.8, -0.1);
glVertex2d(0, 1);
glVertex2d(-0.07, 0.67);
glVertex2d(0, 1);
glVertex2d(0.07, 0.67);
glEnd;
{ось кординат}
glColor3d(1, 1, 1);
glBegin(GL_LINES);
glVertex2d(0, -1);
glVertex2d(0, 1);
glVertex2d(-1, -0);
glVertex2d(1, 0);
glEnd;
glpopMatrix();
wglMakeCurrent(0, 0);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
wglDeleteContext(hrc);
end;
end.