06.01.2012, 19:05
|
Прохожий
|
|
Регистрация: 18.07.2011
Сообщения: 22
Репутация: 12
|
|
dgl
Хочу сменить точку зрения с помощи процедуры glTranslatef(x,y,z); Но когда я меняю точку зрения по z то рисунок пропадает! Пожалуйста помогите!
Вот код:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dglOpengl, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
dc: hdc;
rc: hglrc;
implementation
{$R *.dfm}
procedure setgl;
begin
glClearColor(0.0,0.0,0.0,0.0);
glEnable(gl_depth_test);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
glClear(gl_color_buffer_bit or gl_depth_buffer_bit);
glTranslatef(0.0,0.0,-6.0);
glBegin(gl_Triangles);
glVertex3f(0.0,1.0,0.0);
glVertex3f(-1.0,-1.0,0.0);
glVertex3f(1.0,-1.0,0.0);
glend;
swapbuffers(dc);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
dc:=getdc(handle);
rc:=createrenderingcontext(dc,[opdoublebuffered],32,24,0,0,0,0);
activaterenderingcontext(dc,rc);
setgl;
end;
end.
|