copy to clipboard from TOpenGLContext lazarus / 70-OpenGL ---------------------------------------------------------------------- apeoperaio · 2014-06-12 09:46 Is it possible to copy the content of OpenGLContext to the clipboard? How can be done? ---------------------------------------------------------------------- Ocye · 2014-06-13 13:10 Simply copy the GL content into a bitmap and use clipboard functions (http://wiki.lazarus.freepascal.org/Clipboard). Here is my function to create a screen shot: Code: [Select]function TGLContext.ScreenShot: TBitmap; var   p: array of array[0..3] of byte;   aViewport: array[0..3] of GlInt;   c: TFPColor;   dummy:TLazIntfImage;   dummyHandle, dummyMaskHandle: HBitmap;   x,y:word;   z:longword; begin   MakeCurrent;   glGetIntegerv(GL_VIEWPORT, aViewport);   Result:=TBitmap.Create;   Result.Width:=aViewport[2];   Result.Height:=aViewport[3];   dummy:=TLazIntfImage.Create(0,0);   try     dummy.LoadFromBitmap(result.Handle, result.MaskHandle);     setlength(p, aViewport[2] * aViewport[3]);     glReadPixels(0, 0, aViewport[2], aViewport[3], GL_RGBA, GL_UNSIGNED_BYTE, @p[0,0]);     z:=0;     for y:=0 to Result.Height-1 do      for x:=0 to Result.Width-1 do     begin       c.Red:=p[z][0]*256;;       c.Green:=p[z][1]*256;;       c.Blue:=p[z][2]*256;;       dummy.Colors[x,Result.Height-1-y]:=c;       inc(z);     end;     dummy.CreateBitmaps(dummyHandle, dummyMaskHandle, false);     result.Handle := dummyHandle;     result.MaskHandle := dummyMaskHandle;     setlength(p,0);   finally     dummy.free;   end; end; ---------------------------------------------------------------------- apeoperaio · 2014-06-17 08:37 I tested it but I was able to copy just a portion of the openglcontext. Anyway it is a good starting point. Thanks.