0
可能性の重複:
How Take screenshot opengl game ? for DelphiどのようにフルスクリーンのOpenGLゲームDelphiでのスクリーンショットを取るか?
私はhelp.Iを必要とするには、スクリーンショットフルスクリーンOpenGLのゲームデルファイ源を取る必要があります。ここ
可能性の重複:
How Take screenshot opengl game ? for DelphiどのようにフルスクリーンのOpenGLゲームDelphiでのスクリーンショットを取るか?
私はhelp.Iを必要とするには、スクリーンショットフルスクリーンOpenGLのゲームデルファイ源を取る必要があります。ここ
は私が調理してきた何か、あなたはDelphiのバージョンを指定していないので、これは、D2010に書いている、残念ながら、私が持っている唯一のゲームはカウンターストライク1.6で、その結果は、黒画像です私は(それがラッシュの仕事ですが、私は多くの時間を持っていない)あなたがここからあなたのように動作することができますかなり確信しているので、ここでのコードです:
function TakeGameShot(const AFileName: string; const AWidth, AHeight: Integer): Boolean;
var
LPixels: array of Byte;
LLine: PByteArray;
LBitmap: TBitmap;
Index: Integer;
begin
Result := False;
LBitmap := TBitmap.Create;
try
LBitmap.PixelFormat := pf24bit;
LBitmap.Height := AHeight;
LBitmap.Width := AWidth;
// width * height * 3 bytes/pixel
SetLength(LPixels, AWidth * AHeight * 3);
// tell open gl which buffer we're interested in
glReadBuffer(GL_BACK);
// read pixels
glReadPixels(0, 0, AWidth, AHeight, GL_RGB, GL_UNSIGNED_BYTE, @LPixels);
// scan each line from bitmap
for Index := 0 to AHeight -1 do begin
LLine := LBitmap.ScanLine[ Index ];
// move data from LPixels to LLine, data size = Width * 3(bytes/pixel)
Move(LPixels[ Index * AWidth ], LLine^[0], AWidth * 3);
end; // for Index := 0 to AHeight -1 do begin
// save the bitmap
LBitmap.SaveToFile(AFileName);
// if we reached this line, we're pretty much OK
Result := True;
finally
LBitmap.Free;
end;
end;
あなたは私があなたに投稿したリンクを確認しました前の質問? – TLama
私はdelphi.İtsが必要ですC++ :( –