fast screen capture

Hello, im trying to capture the screen of a OpenGL game, and im trying to make the screen capture as fast as possible, the normal methods are very slow ( 1,300ms~ ) , i would like of a way to capture the screen, even if it will be in bad quality or a small resolution, as long as its fast.
SabrWolfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mocartsCommented:
on my PIII 450mhz this code takes 10 ms to capture screen (800x600)

var
iX, iY: integer;
ScreenDC: HDC;
bmp: TBitmap;
begin
 // for performance it's better to get once (somwhere in form create)
 ScreenDC := GetDC(0);
 try
   iX := Screen.Width;
   iY := Screen.Height;
   Bmp := TBitmap.Create;
   try
     bmp.Height := iY;
     bmp.Width := iX;
     if not BitBlt(bmp.Canvas.Handle, 0,0, iX, iY, ScreenDC, 0, 0, SRCCOPY) then
       raise Exception.Create('Error on copy from DC');
     Image1.Picture.Bitmap := bmp;
   finally
     bmp.free;
   end;
 finally
   ReleaseDC(0, ScreenDC);
 end;
end;
wbr, mo.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SabrWolfAuthor Commented:
hmm is there a way to resize the bmp before i save it to disk ?
0
mocartsCommented:
there are two methods to reduce size of bitmap:
- reducing color count:

bmp.PixelFormat := pf8bit; // pf16bit, pf24bit...
Image1.Picture.Bitmap := bmp;

- resizing (with stretchdraw or resampling for better quality (resampling code can be found at search.borland.com)):

with Image1.Picture.Bitmap do begin
  Height := Trunc(bmp.Height / 1.5);
  Width := Trunc(bmp.Width / 1.5);
  Canvas.StretchDraw(Rect(0, 0, Width, Height), bmp);
end;

and combination of both methods.
wbr, mo.
0
SabrWolfAuthor Commented:
got any way that doesnt involve TBitmap, i dont want to use the VCL..
0
SabrWolfAuthor Commented:
nm. found my answer, thx again!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.