Hi, pygame.image.save() of gl Surfaces is still a problem on windows, causing segfaults.
I commited a test called image__save_gl_surface_test.py cheers. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of René Dudfield Sent: Monday, June 02, 2008 12:35 PM To: pygame-users@seul.org Subject: Re: BUG: pygame.image.save(screen) with pyopengl 3.x Re: [pygame] PyOpenGL Screenshots hi, I fixed this on the weekend. I stopped using pyopengl to get glReadPixels (since pyopengl 3.x broke the glReadPixels API), and instead loaded the gl functions dynamically with C. Committed revision 1261. You can get auto-built binaries for windows/mac osx here if needed: http://thorbrian.com/pygame/builds.php cheers, On Wed, May 7, 2008 at 2:47 PM, René Dudfield <[EMAIL PROTECTED]> wrote: > Added a bug to the subject. > > cu, > > On Wed, May 7, 2008 at 2:44 PM, René Dudfield <[EMAIL PROTECTED]> wrote: >> looks like pyopengl 3.x returns a numpy array now instead of a string >> by default... which breaks pygame.image.save on gl with pyopengl 3.x. >> >> Here's a work around screenshot function for gl. >> >> >> def save_screen(screen, filename): >> >> def readScreen(x, y, width, height): >> """ Read in the screen information in the area specified """ >> glFinish() >> glPixelStorei(GL_PACK_ALIGNMENT, 4) >> glPixelStorei(GL_PACK_ROW_LENGTH, 0) >> glPixelStorei(GL_PACK_SKIP_ROWS, 0) >> glPixelStorei(GL_PACK_SKIP_PIXELS, 0) >> >> data = glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE) >> if hasattr(data, "tostring"): >> data = data.tostring() >> >> return data >> def saveImageData(width, height, data, filename): >> """ Save image data """ >> surface = pygame.image.fromstring(data, (width, height), 'RGB', 1) >> pygame.image.save(surface, filename) >> >> data = readScreen(0,0, screen.get_width(), screen.get_height()) >> saveImageData(screen.get_width(), screen.get_height(), data, filename) >> >> >> >> >> >> On Wed, May 7, 2008 at 2:27 PM, René Dudfield <[EMAIL PROTECTED]> wrote: >> > hi, >> > >> > glReadPixels, make a surface, then use pygame.image.save() >> > >> > Then use ffmpeg, or vlc etc to make a movie out of still frames. >> > >> > cheers, >> > >> >