The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Making a screenshot
benang at cs.its.ac.id
Guest

Hi, anybody know how to make a screenshot of the current backbuffer
surface? Maybe integrating it with Klipper or making a bitmap file of it?
Thanks alot in advance.


Fare thee well,
Bawenang R. P. P.

----------------
ERROR: Brain not found. Please insert a new brain!

?Do nothing which is of no use.? - Miyamoto Musashi.

"I live for my dream. And my dream is to live my life to the fullest."
Making a screenshot
Ken Rogoway
Guest

It is as simple as calling:

SDL_SaveBMP( pSurface,"FILE.BMP" );

The pSurface is a pointer to a SDL_Surface and the string is the filename to
save it as.

Ken Rogoway
Homebrew Software
http://www.homebrewsoftware.com/


-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of benang at cs.its.ac.id
Sent: Tuesday, April 10, 2007 9:51 PM
To: sdl at lists.libsdl.org
Subject: [SDL] Making a screenshot

Hi, anybody know how to make a screenshot of the current backbuffer
surface? Maybe integrating it with Klipper or making a bitmap file of it?
Thanks alot in advance.


Fare thee well,
Bawenang R. P. P.

----------------
ERROR: Brain not found. Please insert a new brain!

?Do nothing which is of no use.? - Miyamoto Musashi.

"I live for my dream. And my dream is to live my life to the fullest."


_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.0.0/754 - Release Date: 4/9/2007
10:59 PM


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.0.0/754 - Release Date: 4/9/2007
10:59 PM
Making a screenshot
Ryan C. Gordon
Guest

Quote:
It is as simple as calling:

SDL_SaveBMP( pSurface,"FILE.BMP" );

The pSurface is a pointer to a SDL_Surface and the string is the filename to
save it as.

Yes. And for OpenGL, call glReadPixels() to get the contents of the
OpenGL framebuffer...then you'd need to get the raw pixel data into some
format you can use (like a SDL_Surface for SDL_SaveBMP, etc).

--ryan.
Making a screenshot
benang at cs.its.ac.id
Guest

Ah, I see thanks guys. Although my first impression about screenshot would
be copying the surface to a clipboard daemon (eg. Klipper, or Windows'
Clipboard). But because I don't understand Linux that much, making a
bitmap file of the surface will be suffice right now. Maybe I'll explore
more on how to copy the surface's contents to KDE's Klipper when I have
time. Thanks alot guys.

Ryan C. Gordon said:
Quote:

Quote:
It is as simple as calling:

SDL_SaveBMP( pSurface,"FILE.BMP" );

The pSurface is a pointer to a SDL_Surface and the string is the
filename to
save it as.

Yes. And for OpenGL, call glReadPixels() to get the contents of the
OpenGL framebuffer...then you'd need to get the raw pixel data into some
format you can use (like a SDL_Surface for SDL_SaveBMP, etc).

--ryan.




_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



Fare thee well,
Bawenang R. P. P.

----------------
ERROR: Brain not found. Please insert a new brain!

?Do nothing which is of no use.? - Miyamoto Musashi.

"I live for my dream. And my dream is to live my life to the fullest."