本文整理汇总了C++中R_GammaCorrect函数的典型用法代码示例。如果您正苦于以下问题:C++ R_GammaCorrect函数的具体用法?C++ R_GammaCorrect怎么用?C++ R_GammaCorrect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_GammaCorrect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: R_TakeScreenshot
// "filename" param is something like "screenshots/shot0000.tga"
// note that if the last extension is ".jpg", then it'll save a JPG, else TGA
//
void R_TakeScreenshot( int x, int y, int width, int height, char *fileName ) {
#ifndef _XBOX
byte *buffer;
int i, c, temp;
qboolean bSaveAsJPG = !strnicmp(&fileName[strlen(fileName)-4],".jpg",4);
if (bSaveAsJPG)
{
// JPG saver expects to be fed RGBA data, though it presumably ignores 'A'...
//
buffer = (unsigned char *) Z_Malloc(glConfig.vidWidth*glConfig.vidHeight*4, TAG_TEMP_WORKSPACE, qfalse);
qglReadPixels( x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
// gamma correct
if ( tr.overbrightBits>0 && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer, glConfig.vidWidth * glConfig.vidHeight * 4 );
}
SaveJPG(fileName, 95, width, height, buffer);
}
else
{
// TGA...
//
buffer = (unsigned char *) Z_Malloc(glConfig.vidWidth*glConfig.vidHeight*3 + 18, TAG_TEMP_WORKSPACE, qfalse);
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = width & 255;
buffer[13] = width >> 8;
buffer[14] = height & 255;
buffer[15] = height >> 8;
buffer[16] = 24; // pixel size
qglReadPixels( x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 );
// swap rgb to bgr
c = 18 + width * height * 3;
for (i=18 ; i<c ; i+=3) {
temp = buffer[i];
buffer[i] = buffer[i+2];
buffer[i+2] = temp;
}
// gamma correct
if ( tr.overbrightBits>0 && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer + 18, glConfig.vidWidth * glConfig.vidHeight * 3 );
}
FS_WriteFile( fileName, buffer, c );
}
Z_Free( buffer );
#endif
}
开发者ID:Camron,项目名称:OpenJK,代码行数:57,代码来源:tr_init.cpp
示例2: R_LevelShot
static void R_LevelShot( void ) {
#ifndef _XBOX
char checkname[MAX_OSPATH];
byte *buffer;
byte *source;
byte *src, *dst;
int x, y;
int r, g, b;
float xScale, yScale;
int xx, yy;
sprintf( checkname, "levelshots/%s.tga", tr.world->baseName );
source = (unsigned char *)Hunk_AllocateTempMemory( glConfig.vidWidth * glConfig.vidHeight * 3 );
buffer = (unsigned char *)Hunk_AllocateTempMemory( LEVELSHOTSIZE * LEVELSHOTSIZE*3 + 18);
Com_Memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = LEVELSHOTSIZE & 255;
buffer[13] = LEVELSHOTSIZE >> 8;
buffer[14] = LEVELSHOTSIZE & 255;
buffer[15] = LEVELSHOTSIZE >> 8;
buffer[16] = 24; // pixel size
qglReadPixels( 0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_RGB, GL_UNSIGNED_BYTE, source );
// resample from source
xScale = glConfig.vidWidth / (4.0*LEVELSHOTSIZE);
yScale = glConfig.vidHeight / (3.0*LEVELSHOTSIZE);
for ( y = 0 ; y < LEVELSHOTSIZE ; y++ ) {
for ( x = 0 ; x < LEVELSHOTSIZE ; x++ ) {
r = g = b = 0;
for ( yy = 0 ; yy < 3 ; yy++ ) {
for ( xx = 0 ; xx < 4 ; xx++ ) {
src = source + 3 * ( glConfig.vidWidth * (int)( (y*3+yy)*yScale ) + (int)( (x*4+xx)*xScale ) );
r += src[0];
g += src[1];
b += src[2];
}
}
dst = buffer + 18 + 3 * ( y * LEVELSHOTSIZE + x );
dst[0] = b / 12;
dst[1] = g / 12;
dst[2] = r / 12;
}
}
// gamma correct
if ( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer + 18, LEVELSHOTSIZE * LEVELSHOTSIZE * 3 );
}
FS_WriteFile( checkname, buffer, LEVELSHOTSIZE * LEVELSHOTSIZE*3 + 18 );
Hunk_FreeTempMemory( buffer );
Hunk_FreeTempMemory( source );
Com_Printf ("Wrote %s\n", checkname );
#endif
}
开发者ID:MrSquirrely,项目名称:Jedi-Academy,代码行数:60,代码来源:tr_init.cpp
示例3: RB_TakeScreenshot
/*
==================
RB_TakeScreenshot
==================
*/
void RB_TakeScreenshot(int x, int y, int width, int height, char *fileName)
{
byte *allbuf, *buffer;
byte *srcptr, *destptr;
byte *endline, *endmem;
byte temp;
int linelen, padlen;
size_t offset = 18, memcount;
allbuf = RB_ReadPixels(x, y, width, height, &offset, &padlen);
buffer = allbuf + offset - 18;
Com_Memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = width & 255;
buffer[13] = width >> 8;
buffer[14] = height & 255;
buffer[15] = height >> 8;
buffer[16] = 24; // pixel size
// swap rgb to bgr and remove padding from line endings
linelen = width * 3;
srcptr = destptr = allbuf + offset;
endmem = srcptr + (linelen + padlen) * height;
while(srcptr < endmem)
{
endline = srcptr + linelen;
while(srcptr < endline)
{
temp = srcptr[0];
*destptr++ = srcptr[2];
*destptr++ = srcptr[1];
*destptr++ = temp;
srcptr += 3;
}
// Skip the pad
srcptr += padlen;
}
memcount = linelen * height;
// gamma correct
if(glConfig.deviceSupportsGamma
//openarena: altbright
&& !r_alternateBrightness->integer
//-openarena
) {
R_GammaCorrect(allbuf + offset, memcount);
}
ri.FS_WriteFile(fileName, buffer, memcount + 18);
ri.Hunk_FreeTempMemory(allbuf);
}
开发者ID:themuffinator,项目名称:fnq3,代码行数:65,代码来源:tr_init.c
示例4: R_LevelShot
void R_LevelShot( void ) {
#ifndef _XBOX
char checkname[MAX_OSPATH];
byte *buffer;
byte *source;
byte *src, *dst;
int x, y;
int r, g, b;
float xScale, yScale;
int xx, yy;
sprintf( checkname, "levelshots/%s.tga", tr.worldDir + strlen("maps/") );
source = (byte*) Z_Malloc( glConfig.vidWidth * glConfig.vidHeight * 3, TAG_TEMP_WORKSPACE, qfalse );
buffer = (byte*) Z_Malloc( LEVELSHOTSIZE * LEVELSHOTSIZE*3 + 18, TAG_TEMP_WORKSPACE, qfalse );
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = LEVELSHOTSIZE & 255;
buffer[13] = LEVELSHOTSIZE >> 8;
buffer[14] = LEVELSHOTSIZE & 255;
buffer[15] = LEVELSHOTSIZE >> 8;
buffer[16] = 24; // pixel size
qglReadPixels( 0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_RGB, GL_UNSIGNED_BYTE, source );
// resample from source
xScale = glConfig.vidWidth / (4.0*LEVELSHOTSIZE);
yScale = glConfig.vidHeight / (3.0*LEVELSHOTSIZE);
for ( y = 0 ; y < LEVELSHOTSIZE ; y++ ) {
for ( x = 0 ; x < LEVELSHOTSIZE ; x++ ) {
r = g = b = 0;
for ( yy = 0 ; yy < 3 ; yy++ ) {
for ( xx = 0 ; xx < 4 ; xx++ ) {
src = source + 3 * ( glConfig.vidWidth * (int)( (y*3+yy)*yScale ) + (int)( (x*4+xx)*xScale ) );
r += src[0];
g += src[1];
b += src[2];
}
}
dst = buffer + 18 + 3 * ( y * LEVELSHOTSIZE + x );
dst[0] = b / 12;
dst[1] = g / 12;
dst[2] = r / 12;
}
}
// gamma correct
if ( glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer + 18, LEVELSHOTSIZE * LEVELSHOTSIZE * 3 );
}
FS_WriteFile( checkname, buffer, LEVELSHOTSIZE * LEVELSHOTSIZE*3 + 18 );
Z_Free( buffer );
Z_Free( source );
VID_Printf( PRINT_ALL, "Wrote %s\n", checkname );
#endif
}
开发者ID:Camron,项目名称:OpenJK,代码行数:60,代码来源:tr_init.cpp
示例5: R_TakeScreenshot
/*
==================
R_TakeScreenshot
==================
*/
void R_TakeScreenshot( int x, int y, int width, int height, char *fileName ) {
byte *buffer;
int i, c, temp;
buffer = (unsigned char *)Hunk_AllocateTempMemory(glConfig.vidWidth*glConfig.vidHeight*3+18);
Com_Memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = width & 255;
buffer[13] = width >> 8;
buffer[14] = height & 255;
buffer[15] = height >> 8;
buffer[16] = 24; // pixel size
qglReadPixels( x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 );
// swap rgb to bgr
c = 18 + width * height * 3;
for (i=18 ; i<c ; i+=3) {
temp = buffer[i];
buffer[i] = buffer[i+2];
buffer[i+2] = temp;
}
// gamma correct
if ( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer + 18, glConfig.vidWidth * glConfig.vidHeight * 3 );
}
FS_WriteFile( fileName, buffer, c );
Hunk_FreeTempMemory( buffer );
}
开发者ID:Camron,项目名称:OpenJK,代码行数:38,代码来源:tr_init.cpp
示例6: R_LevelShot
/*
* R_LevelShot
*
* levelshots are specialized 128*128 thumbnails for
* the menu system, sampled down from full screen distorted images
*/
void
R_LevelShot(void)
{
char checkname[MAX_OSPATH];
byte *buffer;
byte *source, *allsource;
byte *src, *dst;
size_t offset = 0;
int padlen;
int x, y;
int r, g, b;
float xScale, yScale;
int xx, yy;
Q_sprintf(checkname, sizeof(checkname), "levelshots/%s.tga", tr.world->baseName);
allsource = RB_ReadPixels(0, 0, glConfig.vidWidth, glConfig.vidHeight, &offset, &padlen);
source = allsource + offset;
buffer = ri.hunkalloctemp(128 * 128*3 + 18);
Q_Memset (buffer, 0, 18);
buffer[2] = 2; /* uncompressed type */
buffer[12] = 128;
buffer[14] = 128;
buffer[16] = 24; /* pixel size */
/* resample from source */
xScale = glConfig.vidWidth / 512.0f;
yScale = glConfig.vidHeight / 384.0f;
for(y = 0; y < 128; y++)
for(x = 0; x < 128; x++){
r = g = b = 0;
for(yy = 0; yy < 3; yy++)
for(xx = 0; xx < 4; xx++){
src = source +
(3 * glConfig.vidWidth + padlen) * (int)((y*3 + yy) * yScale) +
3 * (int)((x*4 + xx) * xScale);
r += src[0];
g += src[1];
b += src[2];
}
dst = buffer + 18 + 3 * (y * 128 + x);
dst[0] = b / 12;
dst[1] = g / 12;
dst[2] = r / 12;
}
/* gamma correct */
if(glConfig.deviceSupportsGamma){
R_GammaCorrect(buffer + 18, 128 * 128 * 3);
}
ri.fswritefile(checkname, buffer, 128 * 128*3 + 18);
ri.hunkfreetemp(buffer);
ri.hunkfreetemp(allsource);
ri.Printf(PRINT_ALL, "Wrote %s\n", checkname);
}
开发者ID:icanhas,项目名称:yantar,代码行数:65,代码来源:init.c
示例7: R_LevelShot
/*
====================
R_LevelShot
levelshots are specialized 128*128 thumbnails for
the menu system, sampled down from full screen distorted images
====================
*/
void R_LevelShot( void ) {
char checkname[MAX_OSPATH];
byte *buffer;
byte *source;
byte *src, *dst;
int x, y;
int r, g, b;
float xScale, yScale;
int xx, yy;
sprintf( checkname, "levelshots/%s.tga", tr.world->baseName );
source = ri.Hunk_AllocateTempMemory( glConfig.vidWidth * glConfig.vidHeight * 3 );
buffer = ri.Hunk_AllocateTempMemory( 128 * 128*3 + 18);
Com_Memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
buffer[12] = 128;
buffer[14] = 128;
buffer[16] = 24; // pixel size
qglReadPixels( 0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_RGB, GL_UNSIGNED_BYTE, source );
// resample from source
xScale = glConfig.vidWidth / 512.0f;
yScale = glConfig.vidHeight / 384.0f;
for ( y = 0 ; y < 128 ; y++ ) {
for ( x = 0 ; x < 128 ; x++ ) {
r = g = b = 0;
for ( yy = 0 ; yy < 3 ; yy++ ) {
for ( xx = 0 ; xx < 4 ; xx++ ) {
src = source + 3 * ( glConfig.vidWidth * (int)( (y*3+yy)*yScale ) + (int)( (x*4+xx)*xScale ) );
r += src[0];
g += src[1];
b += src[2];
}
}
dst = buffer + 18 + 3 * ( y * 128 + x );
dst[0] = b / 12;
dst[1] = g / 12;
dst[2] = r / 12;
}
}
// gamma correct
if ( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer + 18, 128 * 128 * 3 );
}
ri.FS_WriteFile( checkname, buffer, 128 * 128*3 + 18 );
ri.Hunk_FreeTempMemory( buffer );
ri.Hunk_FreeTempMemory( source );
ri.Printf( PRINT_ALL, "Wrote %s\n", checkname );
}
开发者ID:wtfbbqhax,项目名称:thz,代码行数:64,代码来源:tr_init.c
示例8: RB_TakeScreenshot
/*
* RB_TakeScreenshot
*/
void
RB_TakeScreenshot(int x, int y, int width, int height, char *fileName)
{
byte *allbuf, *buffer;
byte *srcptr, *destptr;
byte *endline, *endmem;
byte temp;
int linelen, padlen;
size_t offset = 18, memcount;
allbuf = RB_ReadPixels(x, y, width, height, &offset, &padlen);
buffer = allbuf + offset - 18;
Q_Memset (buffer, 0, 18);
buffer[2] = 2; /* uncompressed type */
buffer[12] = width & 255;
buffer[13] = width >> 8;
buffer[14] = height & 255;
buffer[15] = height >> 8;
buffer[16] = 24; /* pixel size */
/* swap rgb to bgr and remove padding from line endings */
linelen = width * 3;
srcptr = destptr = allbuf + offset;
endmem = srcptr + (linelen + padlen) * height;
while(srcptr < endmem){
endline = srcptr + linelen;
while(srcptr < endline){
temp = srcptr[0];
*destptr++ = srcptr[2];
*destptr++ = srcptr[1];
*destptr++ = temp;
srcptr += 3;
}
/* Skip the pad */
srcptr += padlen;
}
memcount = linelen * height;
/* gamma correct */
if(glConfig.deviceSupportsGamma)
R_GammaCorrect(allbuf + offset, memcount);
ri.fswritefile(fileName, buffer, memcount + 18);
ri.hunkfreetemp(allbuf);
}
开发者ID:icanhas,项目名称:yantar,代码行数:57,代码来源:init.c
示例9: R_TakeScreenshotPNG
/*
==================
R_TakeScreenshotPNG
==================
*/
static void R_TakeScreenshotPNG( int x, int y, int width, int height, char *fileName )
{
byte *buffer = RB_ReadPixels( x, y, width, height, 0 );
if ( tr.overbrightBits > 0 && glConfig.deviceSupportsGamma )
{
R_GammaCorrect( buffer, 3 * width * height );
}
SavePNG( fileName, buffer, width, height, 3, qfalse );
ri.Hunk_FreeTempMemory( buffer );
}
开发者ID:ZdrytchX,项目名称:Unvanquished-KoRx,代码行数:17,代码来源:tr_init.c
示例10: R_TakeScreenshotJPEG
/*
==================
R_TakeScreenshot
==================
*/
void R_TakeScreenshotJPEG( int x, int y, int width, int height, char *fileName ) {
byte *buffer;
size_t offset = 0, memcount;
int padlen;
buffer = RB_ReadPixels(x, y, width, height, &offset, &padlen);
memcount = (width * 3 + padlen) * height;
// gamma correct
if(glConfig.deviceSupportsGamma)
R_GammaCorrect(buffer + offset, memcount);
RE_SaveJPG(fileName, r_screenshotJpegQuality->integer, width, height, buffer + offset, padlen);
Hunk_FreeTempMemory(buffer);
}
开发者ID:Nuk3R4z0r,项目名称:OpenJK,代码行数:20,代码来源:tr_init.cpp
示例11: R_TakeScreenshotJPEG
void R_TakeScreenshotJPEG(int x, int y, int width, int height, char *fileName) {
byte *buffer;
size_t offset = 0, memcount;
int padlen;
buffer = RB_ReadPixels(x, y, width, height, &offset, &padlen);
memcount = (width * 3 + padlen) * height;
// gamma correct
if (r_gammamethod->integer == GAMMA_HARDWARE)
R_GammaCorrect(buffer + offset, (int)memcount);
SaveJPG(fileName, r_screenshotJpegQuality->integer, width, height, buffer + offset, padlen);
ri.Hunk_FreeTempMemory(buffer);
}
开发者ID:entdark,项目名称:jk2mv,代码行数:15,代码来源:tr_init.cpp
示例12: RB_TakeScreenshotPNG
/*
==================
RB_TakeScreenshotPNG
==================
*/
static void RB_TakeScreenshotPNG(int x, int y, int width, int height, char *fileName)
{
byte *buffer;
size_t offset = 0, memcount;
int padlen;
buffer = RB_ReadPixels(x, y, width, height, &offset, &padlen);
memcount = (width * 3 + padlen) * height;
// gamma correct
if(glConfig.deviceSupportsGamma)
R_GammaCorrect(buffer + offset, memcount);
RE_SavePNG(fileName, width, height, buffer+offset, 3, padlen, qfalse);
ri.Hunk_FreeTempMemory(buffer);
}
开发者ID:Lrns123,项目名称:jkaq3,代码行数:21,代码来源:tr_init.c
示例13: R_TakeScreenshotJPEG
/*
==================
R_TakeScreenshot
==================
*/
void R_TakeScreenshotJPEG( int x, int y, int width, int height, char *fileName ) {
byte *buffer;
buffer = (unsigned char *)Hunk_AllocateTempMemory(glConfig.vidWidth*glConfig.vidHeight*4);
qglReadPixels( x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
// gamma correct
if ( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer, glConfig.vidWidth * glConfig.vidHeight * 4 );
}
FS_WriteFile( fileName, buffer, 1 ); // create path
SaveJPG( fileName, 95, glConfig.vidWidth, glConfig.vidHeight, buffer);
Hunk_FreeTempMemory( buffer );
}
开发者ID:Camron,项目名称:OpenJK,代码行数:22,代码来源:tr_init.cpp
示例14: RB_TakeScreenshotJPEG
/*
==================
RB_TakeScreenshotJPEG
==================
*/
void RB_TakeScreenshotJPEG( int x, int y, int width, int height, char *fileName ) {
byte *buffer;
buffer = (byte *)ri.Hunk_AllocateTempMemory(glConfig.vidWidth*glConfig.vidHeight*4); // ***GREGS_VC9_PORT_MOD*** -- needed typecast
qglReadPixels( x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
// gamma correct
if ( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer, glConfig.vidWidth * glConfig.vidHeight * 4 );
}
ri.FS_WriteFile( fileName, buffer, 1 ); // create path
SaveJPG( fileName, 95, glConfig.vidWidth, glConfig.vidHeight, buffer);
ri.Hunk_FreeTempMemory( buffer );
}
开发者ID:mtrencseni,项目名称:quake3,代码行数:22,代码来源:tr_init.c
示例15: R_LevelShot
// levelshots are specialized 128*128 thumbnails for the menu system, sampled
// down from full screen distorted images
static void R_LevelShot() {
char checkname[ MAX_OSPATH ];
String::Sprintf( checkname, MAX_OSPATH, "levelshots/%s.tga", tr.world->baseName );
byte* source = new byte[ glConfig.vidWidth * glConfig.vidHeight * 3 ];
byte* buffer = new byte[ 128 * 128 * 3 ];
qglReadPixels( 0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_RGB, GL_UNSIGNED_BYTE, source );
// resample from source
float xScale = glConfig.vidWidth / 512.0f;
float yScale = glConfig.vidHeight / 384.0f;
for ( int y = 0; y < 128; y++ ) {
for ( int x = 0; x < 128; x++ ) {
int r = 0;
int g = 0;
int b = 0;
for ( int yy = 0; yy < 3; yy++ ) {
for ( int xx = 0; xx < 4; xx++ ) {
byte* src = source + 3 * ( glConfig.vidWidth * ( int )( ( y * 3 + yy ) * yScale ) + ( int )( ( x * 4 + xx ) * xScale ) );
r += src[ 0 ];
g += src[ 1 ];
b += src[ 2 ];
}
}
byte* dst = buffer + 3 * ( y * 128 + x );
dst[ 0 ] = r / 12;
dst[ 1 ] = g / 12;
dst[ 2 ] = b / 12;
}
}
// gamma correct
if ( tr.overbrightBits > 0 && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer, 128 * 128 * 3 );
}
R_SaveTGA( checkname, buffer, 128, 128, false );
delete[] buffer;
delete[] source;
common->Printf( "Wrote %s\n", checkname );
}
开发者ID:janisl,项目名称:jlquake,代码行数:47,代码来源:screenshot.cpp
示例16: RB_TakeScreenshotJPEG
/*
==================
RB_TakeScreenshotJPEG
==================
*/
void RB_TakeScreenshotJPEG( int x, int y, int width, int height, char *fileName ) {
byte *buffer;
int quality = r_jpegQuality -> value;
buffer = ri.Hunk_AllocateTempMemory(glConfig.vidWidth*glConfig.vidHeight*4);
qglReadPixels( x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
// gamma correct
if ( glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer, glConfig.vidWidth * glConfig.vidHeight * 4 );
}
ri.FS_WriteFile( fileName, buffer, 1 ); // create path
SaveJPG( fileName, quality, glConfig.vidWidth, glConfig.vidHeight, buffer);
ri.Hunk_FreeTempMemory( buffer );
}
开发者ID:trusteed,项目名称:ioq3-for-UrbanTerror-5,代码行数:23,代码来源:tr_init.c
示例17: RB_TakeScreenshot
static void RB_TakeScreenshot( int x, int y, int width, int height, const char* fileName, bool IsJpeg ) {
byte* buffer = new byte[ width * height * 3 ];
qglReadPixels( x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer );
// gamma correct
if ( tr.overbrightBits > 0 && glConfig.deviceSupportsGamma ) {
R_GammaCorrect( buffer, width * height * 3 );
}
if ( IsJpeg ) {
FS_WriteFile( fileName, buffer, 1 ); // create path
R_SaveJPG( fileName, 95, width, height, buffer );
} else {
R_SaveTGA( fileName, buffer, width, height, false );
}
delete[] buffer;
}
开发者ID:janisl,项目名称:jlquake,代码行数:19,代码来源:screenshot.cpp
示例18: glReadPixels
/*
==================
RB_TakeVideoFrameCmd
==================
*/
const void *RB_TakeVideoFrameCmd(const void *data)
{
const videoFrameCommand_t *cmd;
int frameSize;
int i;
cmd = (const videoFrameCommand_t *)data;
// check if the recording is still going on, the buffer might have cmds eventho the recording has stopped
if (ri.CL_VideoRecording())
{
glReadPixels(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)
{
/* This should be fixed
frameSize = RE_SaveJPGToBuffer(cmd->encodeBuffer, 90, cmd->width, cmd->height, cmd->captureBuffer);
ri.CL_WriteAVIVideoFrame(cmd->encodeBuffer, frameSize);
*/
}
else
{
frameSize = cmd->width * cmd->height;
for (i = 0; i < frameSize; i++) // Pack to 24bpp and swap R and B
{
cmd->encodeBuffer[i * 3] = cmd->captureBuffer[i * 4 + 2];
cmd->encodeBuffer[i * 3 + 1] = cmd->captureBuffer[i * 4 + 1];
cmd->encodeBuffer[i * 3 + 2] = cmd->captureBuffer[i * 4];
}
ri.CL_WriteAVIVideoFrame(cmd->encodeBuffer, frameSize * 3);
}
}
return (const void *)(cmd + 1);
}
开发者ID:vishen,项目名称:etlegacy,代码行数:44,代码来源:tr_init.c
示例19: R_TakeScreenshot
/*
==================
R_TakeScreenshot
==================
*/
static void R_TakeScreenshot( int x, int y, int width, int height, char *fileName )
{
byte *buffer;
int dataSize;
byte *end, *p;
// with 18 bytes for the TGA file header
buffer = RB_ReadPixels( x, y, width, height, 18 );
Com_Memset( buffer, 0, 18 );
buffer[ 2 ] = 2; // uncompressed type
buffer[ 12 ] = width & 255;
buffer[ 13 ] = width >> 8;
buffer[ 14 ] = height & 255;
buffer[ 15 ] = height >> 8;
buffer[ 16 ] = 24; // pixel size
dataSize = 3 * width * height;
// RGB to BGR
end = buffer + 18 + dataSize;
for ( p = buffer + 18; p < end; p += 3 )
{
byte temp = p[ 0 ];
p[ 0 ] = p[ 2 ];
p[ 2 ] = temp;
}
if ( tr.overbrightBits > 0 && glConfig.deviceSupportsGamma )
{
R_GammaCorrect( buffer + 18, dataSize );
}
ri.FS_WriteFile( fileName, buffer, 18 + dataSize );
ri.Hunk_FreeTempMemory( buffer );
}
开发者ID:ZdrytchX,项目名称:Unvanquished-KoRx,代码行数:43,代码来源:tr_init.c
示例20: qglReadPixels
/*
==================
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( glConfig.deviceSupportsGamma )
R_GammaCorrect( cmd->captureBuffer, cmd->width * cmd->height * 4 );
if( cmd->motionJpeg )
{
frameSize = SaveJPGToBuffer( cmd->encodeBuffer, 90,
cmd->width, cmd->height, cmd->captureBuffer );
ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize );
}
else
{
frameSize = cmd->width * cmd->height;
for( i = 0; i < frameSize; i++) // Pack to 24bpp and swap R and B
{
cmd->encodeBuffer[ i*3 ] = cmd->captureBuffer[ i*4 + 2 ];
cmd->encodeBuffer[ i*3 + 1 ] = cmd->captureBuffer[ i*4 + 1 ];
cmd->encodeBuffer[ i*3 + 2 ] = cmd->captureBuffer[ i*4 ];
}
ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize * 3 );
}
return (const void *)(cmd + 1);
}
开发者ID:trusteed,项目名称:ioq3-for-UrbanTerror-5,代码行数:42,代码来源:tr_init.c
注:本文中的R_GammaCorrect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论