[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: BUG: pygame.image.save(screen) with pyopengl 3.x Re: [pygame] PyOpenGL Screenshots
- To: pygame-users@xxxxxxxx
- Subject: Re: BUG: pygame.image.save(screen) with pyopengl 3.x Re: [pygame] PyOpenGL Screenshots
- From: "René Dudfield" <renesd@xxxxxxxxx>
- Date: Mon, 2 Jun 2008 12:35:07 +1000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 01 Jun 2008 22:35:12 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=e9Pu7aOubxaaXf0+2LZI8V2xyZAsfIPhcil7/g5kx9s=; b=Z7omlndIJ9SKBs3TbJ239onbu76dU8j++u/pVnlGdjAotbz+pktWfzC+xq8iEdUX64K1jws+P8pvLBSSAXRihrFmj47kxAl4ohgwqupRtjlZFIXQD0LB9zTMRfwWP67X5K6HODd2T4LOFUHEpdPcGe+leee2xavr+LV8JeDb+Fk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JQcHfG2Rm6SdXUvVaS7HvV00abQ6kbGuAmLgyB8RSIrs/8zCoSZJdXoF03w0Gx534buPSzwwP37NOD6idWOZ3sF7VysRGx6ezEWieFV5+gELb5JPPcw4DQUVVw8USPSAmpb+o0ZlEnjOowEGplTjrrjZCR+7poIYpLE4jIFr3O4=
- In-reply-to: <64ddb72c0805062147m17b85289y88423d81b428a687@xxxxxxxxxxxxxx>
- References: <64ddb72c0805062147m17b85289y88423d81b428a687@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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 <renesd@xxxxxxxxx> wrote:
> Added a bug to the subject.
>
> cu,
>
> On Wed, May 7, 2008 at 2:44 PM, René Dudfield <renesd@xxxxxxxxx> 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 <renesd@xxxxxxxxx> 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,
>> >
>>
>