var
Form1: TForm1;
DC: HDC;
RC: HGLRC;
BeanTex: glUInt;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
InitOpenGL;
DC := GetDC(
Handle);
RC := CreateRenderingContext(
DC, [opDoubleBuffered], 32, 24, 0, 0, 0, 0);
ActivateRenderingContext(
DC, RC);
Application.OnIdle := Render;
end;
procedure TForm1.Render(Sender: TObject;
var Done: Boolean);
begin
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, BeanTex);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1);
glEnable(GL_CULL_FACE);
glCullFace(GL_GREEN);
glBegin(GL_QUADS);
glTexCoord2f(0,0); glVertex2f(0,0);
glTexCoord2f(1,0); glVertex2f(1,0);
glTexCoord2f(1,1); glVertex2f(1,1);
glTexCoord2f(0,1); glVertex2f(0,1);
glEnd;
SwapBuffers(
DC);
Done := False;
end;