Several examples of how to use PyOpenGL for off-screen rendering and saving rendered image to file. 3 methods are used: using GLUT hidden window, using WGL to create context with default buffer, as well as creation of OpenGL Framebuffer Object by hands and display results with anti-aliasing in the interactive window .
When you just import WGL, glReadPixels() starts to crash with
ctypes.ArgumentError: argument 7: : wrong type
Go to [package dir]\OpenGL\raw\WGL_types.py , find the following lines
HANDLE = POINTER(None) # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:60
# TODO: figure out how to make the handle not appear as a void_p within the code...
HANDLE.final = True
replace by
HANDLE = UINT64 # for x64, UINT32 for x86
HANDLE.final = True
=======
Offscreen rendering using manually created OpenGL Framebuffer Object
Offscreen rendering using manually created OpenGL Framebuffer Object Standalone code - not using LibGL from this repository
Offscreen rendering using GLUT hidden window
Offscreen rendering using GLUT hidden window Standalone code - not using LibGL from this repository
Offscreen rendering using WGL default buffers with hidden window
Offscreen rendering using WGL default buffers with hidden window Standalone code - not using LibGL from this repository
Render using manually created OpenGL Framebuffer Object Then resize rendered image with anti-aliasing and display it in the window Use mouse to rotate the view
Simple GLUT-based init and double-buffered OpenGL rendering Use keys to rotate the view
Standard double-buffered OpenGL rendering Using WGL SwapBuffers() to show rendered result in the main window Use mouse to rotate the view
Render using default WGL buffers in the second hidden window Then resize rendered image with anti-aliasing and display it in the window Use mouse to rotate the view