- function SaveTexture(Texture: GLuint; x,y,width, height: integer):boolean;
- var
- W: Integer;
- H: Integer;
- BMP : TBitmap;
- Pix : TGraphic;
- begin
- result :=FALSE;
- BMP:=TBitmap.Create;
- BMP.pixelformat:=pf32bit;
- BMP.Width:=width;
- BMP.Height:=height;
- //SetLength(Pix, 3);
- try
- for H:=0 to height do
- begin
- for W:=0 to width do
- begin
- glReadPixels(1, 1, width, height, GL_RGB, GL_BITMAP, Pix);
- BMP.Canvas.Draw(0,0,Pix);
- end;
- end;
- BMP.SaveToFile('C:\...\test.bmp');
- except
- MessageBox(0, PChar('Konnte Texture nicht speichern'), PChar('FEHLER'), MB_OK);
- Exit;
- end;
- BMP.free;
- result :=TRUE;
- end;