本文整理汇总了C++中VID_Printf函数的典型用法代码示例。如果您正苦于以下问题:C++ VID_Printf函数的具体用法?C++ VID_Printf怎么用?C++ VID_Printf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VID_Printf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertCvarRange
static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral, qboolean shouldBeMult2)
{
if ( shouldBeIntegral )
{
if ( ( int ) cv->value != cv->integer )
{
VID_Printf( PRINT_WARNING, "WARNING: cvar '%s' must be integral (%f)\n", cv->name, cv->value );
Cvar_Set( cv->name, va( "%d", cv->integer ) );
}
}
if ( cv->value < minVal )
{
VID_Printf( PRINT_WARNING, "WARNING: cvar '%s' out of range (%f < %f)\n", cv->name, cv->value, minVal );
Cvar_Set( cv->name, va( "%f", minVal ) );
}
else if ( cv->value > maxVal )
{
VID_Printf( PRINT_WARNING, "WARNING: cvar '%s' out of range (%f > %f)\n", cv->name, cv->value, maxVal );
Cvar_Set( cv->name, va( "%f", maxVal ) );
}
if (shouldBeMult2)
{
if ( (cv->integer&(cv->integer-1)) )
{
int newvalue;
for (newvalue = 1 ; newvalue < cv->integer ; newvalue<<=1)
;
VID_Printf( PRINT_WARNING, "WARNING: cvar '%s' must be multiple of 2(%f)\n", cv->name, cv->value );
Cvar_Set( cv->name, va( "%d", newvalue ) );
}
}
}
示例2: GL_Strings_f
/*
** GL_Strings_f
*/
void GL_Strings_f( void )
{
VID_Printf (PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string );
VID_Printf (PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string );
VID_Printf (PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string );
VID_Printf (PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string );
}
示例3: Mod_LoadSpriteModel
/*
=================
Mod_LoadSpriteModel
=================
*/
void Mod_LoadSpriteModel (model_t *mod, void *buffer)
{
dsprite_t *sprin, *sprout;
int i;
sprin = (dsprite_t *)buffer;
sprout = Hunk_Alloc (modfilelen);
sprout->ident = LittleLong (sprin->ident);
sprout->version = LittleLong (sprin->version);
sprout->numframes = LittleLong (sprin->numframes);
if (sprout->version != SPRITE_VERSION)
VID_Printf (ERR_DROP, "%s has wrong version number (%i should be %i)",
mod->name, sprout->version, SPRITE_VERSION);
if (sprout->numframes > MAX_MD2SKINS)
VID_Printf (ERR_DROP, "%s has too many frames (%i > %i)",
mod->name, sprout->numframes, MAX_MD2SKINS);
// byte swap everything
for (i=0 ; i<sprout->numframes ; i++)
{
sprout->frames[i].width = LittleLong (sprin->frames[i].width);
sprout->frames[i].height = LittleLong (sprin->frames[i].height);
sprout->frames[i].origin_x = LittleLong (sprin->frames[i].origin_x);
sprout->frames[i].origin_y = LittleLong (sprin->frames[i].origin_y);
memcpy (sprout->frames[i].name, sprin->frames[i].name, MAX_SKINNAME);
mod->skins[i] = GL_FindImage (sprout->frames[i].name,
it_sprite);
}
mod->type = mod_sprite;
}
示例4: UpdateHardwareGamma
void
UpdateHardwareGamma(void)
{
float gamma = (vid_gamma->value);
int i;
Display* dpy = NULL;
SDL_SysWMinfo info;
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_VERSION(&info.version);
if(!SDL_GetWindowWMInfo(window, &info))
#else
if(SDL_GetWMInfo(&info) != 1)
#endif
{
VID_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
return;
}
dpy = info.info.x11.display;
XRRScreenResources* res = XRRGetScreenResources(dpy, info.info.x11.window);
if(res == NULL)
{
VID_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
return;
}
for(i=0; i < res->ncrtc; ++i)
{
int len = XRRGetCrtcGammaSize(dpy, res->crtcs[i]);
size_t rampSize = len*sizeof(Uint16);
Uint16* ramp = malloc(rampSize); // TODO: check for NULL
if(ramp == NULL)
{
VID_Printf(PRINT_ALL, "Couldn't allocate &zd byte of memory for gamma ramp - OOM?!\n", rampSize);
return;
}
CalculateGammaRamp(gamma, ramp, len);
XRRCrtcGamma* gamma = XRRAllocGamma(len);
memcpy(gamma->red, ramp, rampSize);
memcpy(gamma->green, ramp, rampSize);
memcpy(gamma->blue, ramp, rampSize);
free(ramp);
XRRSetCrtcGamma(dpy, res->crtcs[i], gamma);
XRRFreeGamma(gamma);
}
XRRFreeScreenResources(res);
}
示例5: RestoreGamma
static void RestoreGamma()
{
int i=0;
SDL_SysWMinfo info;
Display* dpy = NULL;
if(gammaRamps == NULL)
return;
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_VERSION(&info.version);
if(!SDL_GetWindowWMInfo(window, &info))
#else
if(SDL_GetWMInfo(&info) != 1)
#endif
{
VID_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
return;
}
dpy = info.info.x11.display;
XRRScreenResources* res = XRRGetScreenResources(dpy, info.info.x11.window);
if(res == NULL)
{
VID_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
return;
}
for(i=0; i < noGammaRamps; ++i)
{
// in case a display was unplugged or something, noGammaRamps may be > res->ncrtc
if(i < res->ncrtc)
{
int len = XRRGetCrtcGammaSize(dpy, res->crtcs[i]);
if(len != gammaRamps[i]->size) {
VID_Printf(PRINT_ALL, "WTF, gamma ramp size for display %d has changed from %d to %d!\n",
i, gammaRamps[i]->size, len);
continue;
}
XRRSetCrtcGamma(dpy, res->crtcs[i], gammaRamps[i]);
}
// the ramp needs to be free()d either way
XRRFreeGamma(gammaRamps[i]);
gammaRamps[i] = NULL;
}
XRRFreeScreenResources(res);
free(gammaRamps);
gammaRamps = NULL;
VID_Printf(PRINT_ALL, "Restored original Gamma\n");
}
示例6: R_ScreenShotTGA_f
/*
==================
R_ScreenShotTGA_f
screenshot
screenshot [silent]
screenshot [levelshot]
screenshot [filename]
Doesn't print the pacifier message if there is a second arg
==================
*/
void R_ScreenShotTGA_f (void) {
#ifndef _XBOX
char checkname[MAX_OSPATH];
int len;
static int lastNumber = -1;
qboolean silent;
if ( !strcmp( Cmd_Argv(1), "levelshot" ) ) {
R_LevelShot();
return;
}
if ( !strcmp( Cmd_Argv(1), "silent" ) ) {
silent = qtrue;
} else {
silent = qfalse;
}
if ( Cmd_Argc() == 2 && !silent ) {
// explicit filename
Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.tga", Cmd_Argv( 1 ) );
} else {
// scan for a free filename
// if we have saved a previous screenshot, don't scan
// again, because recording demo avis can involve
// thousands of shots
if ( lastNumber == -1 ) {
// scan for a free number
for ( lastNumber = 0 ; lastNumber <= 9999 ; lastNumber++ ) {
R_ScreenshotFilename( lastNumber, checkname, ".tga" );
len = FS_ReadFile( checkname, NULL );
if ( len <= 0 ) {
break; // file doesn't exist
}
}
} else {
R_ScreenshotFilename( lastNumber, checkname, ".tga" );
}
if ( lastNumber == 10000 ) {
VID_Printf (PRINT_ALL, "ScreenShot: Couldn't create a file\n");
return;
}
lastNumber++;
}
R_TakeScreenshot( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname );
if ( !silent ) {
VID_Printf (PRINT_ALL, "Wrote %s\n", checkname);
}
#endif
}
示例7: R_ModeList_f
/*
** R_ModeList_f
*/
static void R_ModeList_f( void )
{
int i;
VID_Printf( PRINT_ALL, "\n" );
for ( i = 0; i < s_numVidModes; i++ )
{
VID_Printf( PRINT_ALL, "%s\n", r_vidModes[i].description );
}
VID_Printf( PRINT_ALL, "\n" );
}
示例8: VID_LoadRefresh
/*
==============
VID_LoadRefresh
==============
*/
qboolean VID_LoadRefresh(void)
{
// GetRefAPI_t GetRefAPI;
if ( reflib_active )
{
R_Shutdown();
VID_FreeReflib ();
}
VID_Printf(PRINT_INFO, "-------- Loading OpenGL Ref --------\n");
#if 0
if ( ( reflib_library = LoadLibrary( name ) ) == 0 )
{
VID_Printf(PRINT_ALL, "LoadLibrary(\"%s\") failed\n", name );
return false;
}
#endif
Swap_Init();
#if 0
if ( ( GetRefAPI = (void *) GetProcAddress( reflib_library, "GetRefAPI" ) ) == 0 )
Com_Error( ERR_FATAL, "GetProcAddress failed on %s", name );
re = GetRefAPI( ri );
#endif
#if 0
if (re.api_version != API_VERSION)
{
VID_FreeReflib ();
Com_Error (ERR_FATAL, "%s has incompatible api_version", name);
}
#endif
if ( R_Init( global_hInstance, MainWndProc ) == -1 )
{
R_Shutdown();
VID_FreeReflib ();
return false;
}
VID_Printf(PRINT_INFO, "------------------------------------\n");
reflib_active = true;
return true;
}
示例9: Mod_LoadPlanes
/*
=================
Mod_LoadPlanes
=================
*/
void Mod_LoadPlanes (lump_t *l)
{
int i, j;
cplane_t *out;
dplane_t *in;
int count;
int bits;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
VID_Printf (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*2*sizeof(*out));
loadmodel->planes = out;
loadmodel->numplanes = count;
for ( i=0 ; i<count ; i++, in++, out++)
{
bits = 0;
for (j=0 ; j<3 ; j++)
{
out->normal[j] = LittleFloat (in->normal[j]);
if (out->normal[j] < 0)
bits |= 1<<j;
}
out->dist = LittleFloat (in->dist);
out->type = LittleLong (in->type);
out->signbits = bits;
}
}
示例10: Mod_LoadSubmodels
/*
=================
Mod_LoadSubmodels
=================
*/
void Mod_LoadSubmodels (lump_t *l)
{
dmodel_t *in;
mmodel_t *out;
int i, j, count;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
VID_Printf (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));
loadmodel->submodels = out;
loadmodel->numsubmodels = count;
for ( i=0 ; i<count ; i++, in++, out++)
{
for (j=0 ; j<3 ; j++)
{ // spread the mins / maxs by a pixel
out->mins[j] = LittleFloat (in->mins[j]) - 1;
out->maxs[j] = LittleFloat (in->maxs[j]) + 1;
out->origin[j] = LittleFloat (in->origin[j]);
}
out->radius = RadiusFromBounds (out->mins, out->maxs);
out->headnode = LittleLong (in->headnode);
out->firstface = LittleLong (in->firstface);
out->numfaces = LittleLong (in->numfaces);
}
}
示例11: GLimp_BeginFrame
/*
** GLimp_BeginFrame
*/
void GLimp_BeginFrame( float camera_separation )
{
if ( r_bitdepth->modified )
{
if ( r_bitdepth->value != 0 && !glw_state.allowdisplaydepthchange )
{
Cvar_SetValue( "r_bitdepth", 0 );
VID_Printf( PRINT_ALL, "r_bitdepth requires Win95 OSR2.x or WinNT 4.x\n" );
}
r_bitdepth->modified = false;
}
if ( camera_separation < 0 && gl_state.stereo_enabled )
{
qglDrawBuffer( GL_BACK_LEFT );
}
else if ( camera_separation > 0 && gl_state.stereo_enabled )
{
qglDrawBuffer( GL_BACK_RIGHT );
}
else
{
qglDrawBuffer( GL_BACK );
}
}
示例12: 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
}
示例13: GLimp_GrabInput
/*
* (Un)grab Input
*/
void GLimp_GrabInput(qboolean grab)
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
if(window != NULL)
{
SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE);
}
if(SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE) < 0)
{
VID_Printf(PRINT_ALL, "WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError());
VID_Printf(PRINT_ALL, " You should probably update to SDL 2.0.3 or newer!\n");
}
#else
SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF);
#endif
}
示例14: LogLight
/*
===============
LogLight
===============
*/
static void LogLight( trRefEntity_t *ent ) {
int max1, max2;
/*
if ( !(ent->e.renderfx & RF_FIRST_PERSON ) ) {
return;
}
*/
max1 = VectorLength( ent->ambientLight );
/*
max1 = ent->ambientLight[0];
if ( ent->ambientLight[1] > max1 ) {
max1 = ent->ambientLight[1];
} else if ( ent->ambientLight[2] > max1 ) {
max1 = ent->ambientLight[2];
}
*/
max2 = VectorLength( ent->directedLight );
/*
max2 = ent->directedLight[0];
if ( ent->directedLight[1] > max2 ) {
max2 = ent->directedLight[1];
} else if ( ent->directedLight[2] > max2 ) {
max2 = ent->directedLight[2];
}
*/
VID_Printf( PRINT_ALL, "amb:%i dir:%i direction: (%4.2f, %4.2f, %4.2f)\n", max1, max2, ent->lightDir[0], ent->lightDir[1], ent->lightDir[2] );
}
示例15: GL_TextureMode
/*
===============
GL_TextureMode
===============
*/
void GL_TextureMode( char *string )
{
int i;
image_t *glt;
for (i=0 ; i< NUM_GL_MODES ; i++)
{
if ( !Q_strcasecmp( modes[i].name, string ) )
break;
}
if (i == NUM_GL_MODES)
{
VID_Printf (PRINT_ALL, "bad filter name\n");
return;
}
gl_filter_min = modes[i].minimize;
gl_filter_max = modes[i].maximize;
// change all the existing mipmap texture objects
for (i=0, glt=gltextures ; i<numgltextures ; i++, glt++)
{
if (glt->type != it_pic && glt->type != it_sky )
{
GL_Bind (glt->texnum);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
}
}