/
n-dimens
/
pascalabcnet
Обзор
Документация
Войти
/
n-dimens
/
pascalabcnet
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
3.0
TestSamples/OpenGL/OpenGLTest2.pas
52 строки
1 KB
Бондарев Иван
initial commit
14 май 2015, 22:35
14 май 2015, 22:35
e6e67c1
Код
Авторство
О чём код?
{$reference 'System.Windows.Forms.dll'} {$reference 'System.Drawing.dll'} {$apptype windows} uses System, System.Drawing, System.Windows.Forms, OpenGL; type Form1 = class(Form) _hdc : HDC; constructor Create; begin _hdc := GetDC(self.Handle.ToInt32()); OpenGLInit(self.Handle); end; protected procedure OnPaint(e: System.Windows.Forms.PaintEventArgs); override; begin glClearColor(single(0.0), single(0.0), single(0.0), single(0.0)); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glColor3f(single(0.0), single(1.0), single(0.0)); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(single(-0.5), single(-0.5)); glVertex2f(single(-0.5), single(0.5)); glVertex2f(single(0.5), single(0.5)); glVertex2f(single(0.5), single(-0.5)); glEnd(); glFlush(); SwapBuffers(_hdc); end; procedure Form_Closed(sender : object; e : EventArgs); begin OpenGLUninit(self.Handle); end; procedure Form_Resize(sender: object; e : EventArgs); begin glViewport(0, 0, Width, Height); end; end; var f : Form1; begin f := new Form1(); //f.Load += f.Form_Load; f.Resize += f.Form_Resize; f.Closed += f.Form_Closed; //f.Paint += f.InternalPaint; Application.Run(f); end.