Вот что получилось. Здесь функции для создания opengl окна на static'е, и отрисовка графика функции с сеткой.
procedure SetDCPixelFormat (hdc : HDC);
var
pfd : TPixelFormatDescriptor;
nPixelFormat : Integer;
Begin
With pfd do begin
nSize := sizeof (TPixelFormatDescriptor);
nVersion := 1;
dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL;
iPixelType := PFD_TYPE_RGBA;
cColorBits := 16;
cRedBits := 0;
cRedShift := 0;
cGreenBits := 0;
cGreenShift := 0;
cBlueBits := 0;
cBlueShift := 0;
cAlphaBits := 0;
cAlphaShift := 0;
cAccumBits := 0;
cAccumRedBits := 0;
cAccumGreenBits := 0;
cAccumBlueBits := 0;
cAccumAlphaBits := 0;
cDepthBits := 32;
cStencilBits := 0;
cAuxBuffers := 0;
iLayerType := PFD_MAIN_PLANE;
bReserved := 0;
dwLayerMask := 0;
dwVisibleMask := 0;
dwDamageMask := 0;
end;
PixelFormat := ChoosePixelFormat (hdc, @pfd);
SetPixelFormat (hdc, nPixelFormat, @pfd);
End;
procedure TForm1.FormCreate(Sender: TObject);
var
defstyle:dWord;
begin
stat:=CreateWindowEx(WS_EX_CLIENTEDGE,'static','',WS_CHILD or WS_VISIBLE,232,
30,440,440,Form1.Handle,HMENU(0),hInstance,nil);
dc:=GetDC(stat);
SetDCPixelFormat(dc);
hrc := wglCreateContext(dc);
end;
procedure TForm1.FormPaint(Sender: TObject);
var
t:Gldouble;
begin
t:=0;
BeginPaint (stat, MyPaint);
wglMakeCurrent (dc, hrc);
glClearColor (0.85, 0.75, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor(1.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRenderMode(GL_SELECT);
glLineWidth(1);
gluOrtho2D(-1, 1, -1, 1);
if is_grid=true then
begin
glLineWidth(1);
glBegin (GL_LINES);
glColor3d(0,0,1);
glVertex2f(0,1);
glVertex2f(0,-1);
glVertex2f(1,0);
glVertex2f(-1,0);
glVertex2f(0.5,1);
glVertex2f(0.5,-1);
glVertex2f(-0.5,1);
glVertex2f(-0.5,-1);
glVertex2f(1,0.5);
glVertex2f(-1,0.5);
glVertex2f(1,-0.5);
glVertex2f(-1,-0.5);
glEnd();
end;
glTranslatef(x0/100,y0/100,0);
glScalef(m, m, 0);
glRotatef(fi, 0.0, 0.0, 1.0);
glLineWidth(2);
glBegin (GL_LINE_STRIP);
glColor3d(1,0,0);
while(t<2*pi) do
begin
glVertex2f(x(t),y(t));
t:=t+2*pi/3000;
end;
glEnd();
SwapBuffers(dc);
wglMakeCurrent (dc, 0);
EndPaint (stat, MyPaint);
end;