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德尔福来源。
这里的东西我已经熟了,你有没有指定的德尔福版本,所以这是在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 2012-03-19 09:53:30
我需要delphi.İtsC++ :( – 2012-03-19 10:22:12