This project is read-only.

Exporting 3D model to Image

May 14, 2013 at 4:30 PM

Can someone tell me how to get the pixels of the OpenGl. My problem is, that i don't find the way to do this - i'm new to SharpGL.

Or is there another way to create an image from the OpenGL?

Thanks a lot for helping a newbe
May 27, 2013 at 5:35 AM
Edited May 27, 2013 at 5:36 AM
You need to initialize the SharpGl.RendeContextType as DIBSecion or FBO, for me its better the FBO render context.
After that, just calll the property HBitmap, just like this (for FBORenderContextProvider) :
SharpGL.RenderContextProviders.FBORenderContextProvider provider =(SharpGL.RenderContextProviders.FBORenderContextProvider)OglEscena.OpenGL.RenderContextProvider;
Bitmap Image = Bitmap.FromHbitmap(provider.InternalDIBSection.HBitmap);
//Creamos el nombre y ruta del archivo
 string FileName = System.IO.Path.GetTempFileName().Replace(".tmp", ".bmp");
Image.Save(FileName, ImageFormat.Bmp);
//Se ejecuta el proceso para abrir el archivo
Process.Start(FileName );
May 27, 2013 at 2:01 PM
Thanks @Daniel1809 for posting this!