procedure TMainForm.FormCreate(Sender: TObject);
var
i1, i2: Integer;
begin
If not InitOpenGL
then
begin
ErrorMsg('
Konnte OpenGL nicht initialisieren!'#10'
Error: '+IntToStr(GetLastError));
Exit;
end;
DC := GetDC(
Handle);
RC := CreateRenderingContext(
DC, [opDoubleBuffered], 32, 24, 0, 0, 0, 0);
ActivateRenderingContext(
DC, RC);
glClearColor(0.3, 0.3, 1, 0);
Application.OnIdle := glRender;
try
For i1 := Low(MarioTex)
to High(MarioTex)
do
begin
For i2 := Low(MarioTex[i1])
to High(MarioTex[i1])
do
LoadTexture(GetCurrentDir+'
\Textures\'+IntToStr(i1)+'
\frame_'+GetFrameStr(i2)+'
.jpg', MarioTex[1][i2], False);
end;
except
on E:
Exception do
ErrorMsg('
Konnte Textur['+IntToStr(i1)+'
]['+GetFrameStr(i2)+'
] nicht laden!'#10'
Fehler: ['+IntToStr(GetLastError)+'
]'+E.
Message);
end;
AktFrame := Low(MarioTex);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1);