summaryrefslogtreecommitdiff
path: root/src/renderer/tr_init.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-01-05 04:00:54 +0000
committerTim Angus <tim@ngus.net>2006-01-05 04:00:54 +0000
commit4e6ae21de9bc373801b68a28b66067480bda4288 (patch)
tree0ffa6b987d2ca06daacc7abffe453a4336b3b6da /src/renderer/tr_init.c
parent436df98d2345c4caee3f415e75f009f96ef77697 (diff)
* Merged ioq3-460
- avi exporter - cl_autoRecordDemo - .asm dependencies
Diffstat (limited to 'src/renderer/tr_init.c')
-rw-r--r--src/renderer/tr_init.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c
index a3fd2ca6..79c910d1 100644
--- a/src/renderer/tr_init.c
+++ b/src/renderer/tr_init.c
@@ -701,6 +701,51 @@ void R_ScreenShotJPEG_f (void) {
//============================================================================
/*
+==================
+RB_TakeVideoFrameCmd
+==================
+*/
+const void *RB_TakeVideoFrameCmd( const void *data )
+{
+ const videoFrameCommand_t *cmd;
+ int frameSize;
+ int i;
+
+ cmd = (const videoFrameCommand_t *)data;
+
+ qglReadPixels( 0, 0, cmd->width, cmd->height, GL_RGBA,
+ GL_UNSIGNED_BYTE, cmd->captureBuffer );
+
+ // gamma correct
+ if( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma )
+ R_GammaCorrect( cmd->captureBuffer, cmd->width * cmd->height * 4 );
+
+ if( cmd->motionJpeg )
+ {
+ frameSize = SaveJPGToBuffer( cmd->encodeBuffer, 95,
+ cmd->width, cmd->height, cmd->captureBuffer );
+ }
+ else
+ {
+ frameSize = cmd->width * cmd->height * 4;
+
+ // Vertically flip the image
+ for( i = 0; i < cmd->height; i++ )
+ {
+ Com_Memcpy( &cmd->encodeBuffer[ i * ( cmd->width * 4 ) ],
+ &cmd->captureBuffer[ ( cmd->height - i - 1 ) * ( cmd->width * 4 ) ],
+ cmd->width * 4 );
+ }
+ }
+
+ ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize );
+
+ return (const void *)(cmd + 1);
+}
+
+//============================================================================
+
+/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
@@ -1202,5 +1247,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
re.GetEntityToken = R_GetEntityToken;
re.inPVS = R_inPVS;
+ re.TakeVideoFrame = RE_TakeVideoFrame;
+
return &re;
}