summaryrefslogtreecommitdiff
path: root/src/gl_state.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2011-02-01 16:27:46 +0300
committerAndrey Nazarov <skuller@skuller.net>2011-02-03 17:13:41 +0300
commitc6bb46e48e8d489b6dea9ec74e224efee7ba83ea (patch)
treea82e0be68dd813fa7926ddb257951e112d672743 /src/gl_state.c
parent5d128ec98e1b8e8b8a3e9f41013601045260ab46 (diff)
Move screenshooting code into r_images.
Don't export IMG_SaveXXX functions. Implement IMG_ReadPixels.
Diffstat (limited to 'src/gl_state.c')
-rw-r--r--src/gl_state.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gl_state.c b/src/gl_state.c
index 108d30c..c2be393 100644
--- a/src/gl_state.c
+++ b/src/gl_state.c
@@ -236,6 +236,21 @@ void GL_SetDefaultState( void ) {
GL_Bits( GLS_DEFAULT );
}
+// for screenshots
+byte *IMG_ReadPixels( qboolean reverse, int *width, int *height ) {
+ byte *pixels;
+
+ pixels = FS_AllocTempMem( gl_config.vidWidth * gl_config.vidHeight * 3 );
+
+ qglReadPixels( 0, 0, gl_config.vidWidth, gl_config.vidHeight,
+ reverse ? GL_BGR : GL_RGB, GL_UNSIGNED_BYTE, pixels );
+
+ *width = gl_config.vidWidth;
+ *height = gl_config.vidHeight;
+
+ return pixels;
+}
+
void GL_EnableOutlines( void ) {
if( gls.fp_enabled ) {
qglDisable( GL_FRAGMENT_PROGRAM_ARB );