-
Notifications
You must be signed in to change notification settings - Fork 107
/
gl_backend.c
773 lines (670 loc) · 17.2 KB
/
gl_backend.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
/*
gl_backend.c - rendering backend
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include "common.h"
#include "client.h"
#include "gl_local.h"
#include "mathlib.h"
char r_speeds_msg[MAX_SYSPATH];
ref_speeds_t r_stats; // r_speeds counters
/*
===============
R_SpeedsMessage
===============
*/
qboolean R_SpeedsMessage( char *out, size_t size )
{
if( clgame.drawFuncs.R_SpeedsMessage != NULL )
{
if( clgame.drawFuncs.R_SpeedsMessage( out, size ))
return true;
// otherwise pass to default handler
}
if( r_speeds->integer <= 0 ) return false;
if( !out || !size ) return false;
Q_strncpy( out, r_speeds_msg, size );
return true;
}
/*
==============
GL_BackendStartFrame
==============
*/
void GL_BackendStartFrame( void )
{
r_speeds_msg[0] = '\0';
if( !RI.drawWorld ) R_Set2DMode( false );
}
/*
==============
GL_BackendEndFrame
==============
*/
void GL_BackendEndFrame( void )
{
// go into 2D mode (in case we draw PlayerSetup between two 2d calls)
if( !RI.drawWorld ) R_Set2DMode( true );
if( r_speeds->integer <= 0 || !RI.drawWorld )
return;
switch( r_speeds->integer )
{
case 1:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i wpoly, %3i bpoly\n%3i epoly, %3i spoly",
r_stats.c_world_polys, r_stats.c_brush_polys, r_stats.c_studio_polys, r_stats.c_sprite_polys );
break;
case 2:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "visible leafs:\n%3i leafs\ncurrent leaf %3li",
r_stats.c_world_leafs, r_viewleaf - cl.worldmodel->leafs );
break;
case 3:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i studio models drawn\n%3i sprites drawn",
r_stats.c_studio_models_drawn, r_stats.c_sprite_models_drawn );
break;
case 4:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i static entities\n%3i normal entities",
r_numStatics, r_numEntities - r_numStatics );
break;
case 5:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i tempents\n%3i viewbeams\n%3i particles",
r_stats.c_active_tents_count, r_stats.c_view_beams_count, r_stats.c_particle_count );
break;
case 6:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i mirrors\n", r_stats.c_mirror_passes );
break;
}
Q_memset( &r_stats, 0, sizeof( r_stats ));
}
/*
=================
GL_LoadTexMatrix
=================
*/
void GL_LoadTexMatrix( cmatrix4x4 m )
{
pglMatrixMode( GL_TEXTURE );
GL_LoadMatrix( m );
glState.texIdentityMatrix[glState.activeTMU] = false;
}
/*
=================
GL_LoadTexMatrixExt
=================
*/
void GL_LoadTexMatrixExt( const float *glmatrix )
{
ASSERT( glmatrix != NULL );
pglMatrixMode( GL_TEXTURE );
pglLoadMatrixf( glmatrix );
glState.texIdentityMatrix[glState.activeTMU] = false;
}
/*
=================
GL_LoadMatrix
=================
*/
void GL_LoadMatrix( cmatrix4x4 source )
{
GLfloat dest[16];
Matrix4x4_ToArrayFloatGL( source, dest );
pglLoadMatrixf( dest );
}
/*
=================
GL_LoadIdentityTexMatrix
=================
*/
void GL_LoadIdentityTexMatrix( void )
{
if( glState.texIdentityMatrix[glState.activeTMU] )
return;
pglMatrixMode( GL_TEXTURE );
pglLoadIdentity();
glState.texIdentityMatrix[glState.activeTMU] = true;
}
/*
=================
GL_MaxTextureUnits
=================
*/
int GL_MaxTextureUnits( void )
{
if( glConfig.max_texture_units_cached == -1 )
{
if( GL_Support( GL_SHADER_GLSL100_EXT ))
glConfig.max_texture_units_cached = min( max( glConfig.max_texture_coords, glConfig.max_teximage_units ), MAX_TEXTURE_UNITS );
else
glConfig.max_texture_units_cached = glConfig.max_texture_units;
}
return glConfig.max_texture_units_cached;
}
/*
=================
GL_SelectTexture
=================
*/
void GL_SelectTexture( GLint tmu )
{
if( !GL_Support( GL_ARB_MULTITEXTURE ))
return;
// don't allow negative texture units
if( tmu < 0 ) return;
if( tmu >= GL_MaxTextureUnits( ))
{
MsgDev( D_ERROR, "GL_SelectTexture: bad tmu state %i\n", tmu );
return;
}
if( glState.activeTMU == tmu )
return;
glState.activeTMU = tmu;
#ifndef XASH_NANOGL
if( pglActiveTextureARB )
#endif
{
pglActiveTextureARB( tmu + GL_TEXTURE0_ARB );
if( tmu < glConfig.max_texture_coords )
pglClientActiveTextureARB( tmu + GL_TEXTURE0_ARB );
}
#ifndef XASH_NANOGL
else if( pglSelectTextureSGIS )
{
pglSelectTextureSGIS( tmu + GL_TEXTURE0_SGIS );
}
#endif
}
/*
==============
GL_DisableAllTexGens
==============
*/
void GL_DisableAllTexGens( void )
{
GL_TexGen( GL_S, 0 );
GL_TexGen( GL_T, 0 );
GL_TexGen( GL_R, 0 );
GL_TexGen( GL_Q, 0 );
}
/*
==============
GL_CleanUpTextureUnits
==============
*/
void GL_CleanUpTextureUnits( int last )
{
int i;
for( i = glState.activeTMU; i > (last - 1); i-- )
{
// disable upper units
if( glState.currentTextureTargets[i] != GL_NONE )
{
pglDisable( glState.currentTextureTargets[i] );
glState.currentTextureTargets[i] = GL_NONE;
glState.currentTextures[i] = -1; // unbind texture
}
GL_SetTexCoordArrayMode( GL_NONE );
GL_LoadIdentityTexMatrix();
GL_DisableAllTexGens();
GL_SelectTexture( i - 1 );
}
}
/*
=================
GL_MultiTexCoord2f
=================
*/
void GL_MultiTexCoord2f( GLenum texture, GLfloat s, GLfloat t )
{
#ifndef XASH_NANOGL
if( pglMultiTexCoord2f )
#endif
{
pglMultiTexCoord2f( texture + GL_TEXTURE0_ARB, s, t );
}
#ifndef XASH_NANOGL
else if( pglMTexCoord2fSGIS )
{
pglMTexCoord2fSGIS( texture + GL_TEXTURE0_SGIS, s, t );
}
#endif
}
/*
=================
GL_TextureTarget
=================
*/
void GL_TextureTarget( uint target )
{
if( glState.activeTMU < 0 || glState.activeTMU >= GL_MaxTextureUnits( ))
{
MsgDev( D_ERROR, "GL_TextureTarget: bad tmu state %i\n", glState.activeTMU );
return;
}
if( glState.currentTextureTargets[glState.activeTMU] != target )
{
if( glState.currentTextureTargets[glState.activeTMU] != GL_NONE )
pglDisable( glState.currentTextureTargets[glState.activeTMU] );
glState.currentTextureTargets[glState.activeTMU] = target;
if( target != GL_NONE )
pglEnable( glState.currentTextureTargets[glState.activeTMU] );
}
}
/*
=================
GL_TexGen
=================
*/
void GL_TexGen( GLenum coord, GLenum mode )
{
int tmu = min( glConfig.max_texture_coords, glState.activeTMU );
int bit, gen;
switch( coord )
{
case GL_S:
bit = 1;
gen = GL_TEXTURE_GEN_S;
break;
case GL_T:
bit = 2;
gen = GL_TEXTURE_GEN_T;
break;
case GL_R:
bit = 4;
gen = GL_TEXTURE_GEN_R;
break;
case GL_Q:
bit = 8;
gen = GL_TEXTURE_GEN_Q;
break;
default: return;
}
if( mode )
{
if( !( glState.genSTEnabled[tmu] & bit ))
{
pglEnable( gen );
glState.genSTEnabled[tmu] |= bit;
}
pglTexGeni( coord, GL_TEXTURE_GEN_MODE, mode );
}
else
{
if( glState.genSTEnabled[tmu] & bit )
{
pglDisable( gen );
glState.genSTEnabled[tmu] &= ~bit;
}
}
}
/*
=================
GL_SetTexCoordArrayMode
=================
*/
void GL_SetTexCoordArrayMode( GLenum mode )
{
int tmu = min( glConfig.max_texture_coords, glState.activeTMU );
int bit, cmode = glState.texCoordArrayMode[tmu];
if( mode == GL_TEXTURE_COORD_ARRAY )
bit = 1;
else if( mode == GL_TEXTURE_CUBE_MAP_ARB )
bit = 2;
else bit = 0;
if( cmode != bit )
{
if( cmode == 1 ) pglDisableClientState( GL_TEXTURE_COORD_ARRAY );
else if( cmode == 2 ) pglDisable( GL_TEXTURE_CUBE_MAP_ARB );
if( bit == 1 ) pglEnableClientState( GL_TEXTURE_COORD_ARRAY );
else if( bit == 2 ) pglEnable( GL_TEXTURE_CUBE_MAP_ARB );
glState.texCoordArrayMode[tmu] = bit;
}
}
/*
=================
GL_Cull
=================
*/
void GL_Cull( GLenum cull )
{
if( !cull )
{
pglDisable( GL_CULL_FACE );
glState.faceCull = 0;
return;
}
pglEnable( GL_CULL_FACE );
pglCullFace( cull );
glState.faceCull = cull;
}
/*
=================
GL_FrontFace
=================
*/
void GL_FrontFace( GLenum front )
{
pglFrontFace( front ? GL_CW : GL_CCW );
glState.frontFace = front;
}
void GAME_EXPORT GL_SetRenderMode( int mode )
{
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
switch( mode )
{
case kRenderNormal:
default:
pglDisable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
break;
case kRenderTransColor:
case kRenderTransTexture:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
break;
case kRenderTransAlpha:
pglDisable( GL_BLEND );
pglEnable( GL_ALPHA_TEST );
break;
case kRenderGlow:
case kRenderTransAdd:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
#if defined(XASH_BLEND_ES_WORKAROUND) // Problem with blending exists on every GLES configuration, not only on Android
pglBlendFunc( GL_ONE, GL_ONE );
#else
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
#endif
break;
}
}
/*
==============================================================================
SCREEN SHOTS
==============================================================================
*/
// used for 'env' and 'sky' shots
typedef struct envmap_s
{
vec3_t angles;
int flags;
} envmap_t;
const envmap_t r_skyBoxInfo[6] =
{
{{ 0, 270, 180}, IMAGE_FLIP_X },
{{ 0, 90, 180}, IMAGE_FLIP_X },
{{ -90, 0, 180}, IMAGE_FLIP_X },
{{ 90, 0, 180}, IMAGE_FLIP_X },
{{ 0, 0, 180}, IMAGE_FLIP_X },
{{ 0, 180, 180}, IMAGE_FLIP_X },
};
const envmap_t r_envMapInfo[6] =
{
{{ 0, 0, 90}, 0 },
{{ 0, 180, -90}, 0 },
{{ 0, 90, 0}, 0 },
{{ 0, 270, 180}, 0 },
{{-90, 180, -90}, 0 },
{{ 90, 0, 90}, 0 }
};
/*
================
VID_ImageAdjustGamma
================
*/
void VID_ImageAdjustGamma( byte *in, uint width, uint height )
{
int i, c = width * height;
float g = 1.0f / bound( 0.5f, vid_gamma->value, 2.3f );
byte r_gammaTable[256]; // adjust screenshot gamma
byte *p = in;
if( !gl_compensate_gamma_screenshots->integer )
return;
// rebuild the gamma table
for( i = 0; i < 256; i++ )
{
if( g == 1.0f ) r_gammaTable[i] = i;
else r_gammaTable[i] = bound( 0, 255 * pow((i + 0.5) / 255.5f, g ) + 0.5f, 255 );
}
// adjust screenshots gamma
for( i = 0; i < c; i++, p += 3 )
{
p[0] = r_gammaTable[p[0]];
p[1] = r_gammaTable[p[1]];
p[2] = r_gammaTable[p[2]];
}
}
qboolean VID_ScreenShot( const char *filename, int shot_type )
{
rgbdata_t *r_shot;
uint flags = IMAGE_FLIP_Y;
int width = 0, height = 0;
qboolean result;
r_shot = Mem_Alloc( r_temppool, sizeof( rgbdata_t ));
r_shot->width = (glState.width + 3) & ~3;
r_shot->height = (glState.height + 3) & ~3;
r_shot->flags = IMAGE_HAS_COLOR | IMAGE_HAS_ALPHA;
r_shot->type = PF_RGBA_32;
r_shot->size = r_shot->width * r_shot->height * PFDesc[r_shot->type].bpp;
r_shot->palette = NULL;
r_shot->buffer = Mem_Alloc( r_temppool, r_shot->size );
// get screen frame
pglPixelStorei(GL_PACK_ALIGNMENT, 1); // PANDORA, just in case
pglReadPixels( 0, 0, r_shot->width, r_shot->height, GL_RGBA, GL_UNSIGNED_BYTE, r_shot->buffer );
switch( shot_type )
{
case VID_SCREENSHOT:
if( !gl_overview->integer )
VID_ImageAdjustGamma( r_shot->buffer, r_shot->width, r_shot->height ); // scrshot gamma
break;
case VID_SNAPSHOT:
if( !gl_overview->integer )
VID_ImageAdjustGamma( r_shot->buffer, r_shot->width, r_shot->height ); // scrshot gamma
FS_AllowDirectPaths( true );
break;
case VID_LEVELSHOT:
flags |= IMAGE_RESAMPLE;
if( glState.wideScreen )
{
height = 480;
width = 800;
}
else
{
height = 480;
width = 640;
}
break;
case VID_MINISHOT:
flags |= IMAGE_RESAMPLE;
height = 200;
width = 320;
break;
case VID_MAPSHOT:
V_WriteOverviewScript(); // store overview script too
flags |= IMAGE_RESAMPLE|IMAGE_QUANTIZE; // GoldSrc request overviews in 8-bit format
height = 768;
width = 1024;
break;
}
Image_Process( &r_shot, width, height, 0.0f, flags, NULL );
// write image
result = FS_SaveImage( filename, r_shot );
host.write_to_clipboard = false; // disable write to clipboard
FS_AllowDirectPaths( false ); // always reset after store screenshot
FS_FreeImage( r_shot );
return result;
}
/*
=================
VID_CubemapShot
=================
*/
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot )
{
rgbdata_t *r_shot, *r_side;
byte *temp = NULL;
byte *buffer = NULL;
string basename;
int i = 1, flags, result;
if( !RI.drawWorld || !cl.worldmodel )
return false;
// make sure the specified size is valid
while( i < size ) i<<=1;
if( i != size ) return false;
if( size > glState.width || size > glState.height )
return false;
// setup refdef
RI.params |= RP_ENVVIEW; // do not render non-bmodel entities
// alloc space
temp = Mem_Alloc( r_temppool, size * size * 3 );
buffer = Mem_Alloc( r_temppool, size * size * 3 * 6 );
r_shot = Mem_Alloc( r_temppool, sizeof( rgbdata_t ));
r_side = Mem_Alloc( r_temppool, sizeof( rgbdata_t ));
// use client vieworg
if( !vieworg ) vieworg = cl.refdef.vieworg;
for( i = 0; i < 6; i++ )
{
// go into 3d mode
R_Set2DMode( false );
if( skyshot )
{
R_DrawCubemapView( vieworg, r_skyBoxInfo[i].angles, size );
flags = r_skyBoxInfo[i].flags;
}
else
{
R_DrawCubemapView( vieworg, r_envMapInfo[i].angles, size );
flags = r_envMapInfo[i].flags;
}
pglReadPixels( 0, 0, size, size, GL_RGB, GL_UNSIGNED_BYTE, temp );
r_side->flags = IMAGE_HAS_COLOR;
r_side->width = r_side->height = size;
r_side->type = PF_RGB_24;
r_side->size = r_side->width * r_side->height * 3;
r_side->buffer = temp;
if( flags ) Image_Process( &r_side, 0, 0, 0.0f, flags, NULL );
Q_memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 );
}
RI.params &= ~RP_ENVVIEW;
r_shot->flags = IMAGE_HAS_COLOR;
r_shot->flags |= (skyshot) ? IMAGE_SKYBOX : IMAGE_CUBEMAP;
r_shot->width = size;
r_shot->height = size;
r_shot->type = PF_RGB_24;
r_shot->size = r_shot->width * r_shot->height * 3 * 6;
r_shot->palette = NULL;
r_shot->buffer = buffer;
// make sure what we have right extension
Q_strncpy( basename, base, MAX_STRING );
FS_StripExtension( basename );
FS_DefaultExtension( basename, ".tga" );
// write image as 6 sides
result = FS_SaveImage( basename, r_shot );
FS_FreeImage( r_shot );
FS_FreeImage( r_side );
return result;
}
//=======================================================
/*
===============
R_ShowTextures
Draw all the images to the screen, on top of whatever
was there. This is used to test for texture thrashing.
===============
*/
void R_ShowTextures( void )
{
gltexture_t *image;
float x, y, w, h;
int i, j, k, base_w, base_h;
int total, start, end;
rgba_t color = { 192, 192, 192, 255 };
int charHeight, numTries = 0;
static qboolean showHelp = true;
string shortname;
if( !gl_showtextures->integer )
return;
if( showHelp )
{
CL_CenterPrint( "use '<-' and '->' keys to view all the textures", 0.25f );
showHelp = false;
}
pglClear( GL_COLOR_BUFFER_BIT );
pglFinish();
base_w = 8;
base_h = 6;
rebuild_page:
total = base_w * base_h;
start = total * (gl_showtextures->integer - 1);
end = total * gl_showtextures->integer;
if( end > MAX_TEXTURES ) end = MAX_TEXTURES;
w = glState.width / (float)base_w;
h = glState.height / (float)base_h;
Con_DrawStringLen( NULL, NULL, &charHeight );
for( i = j = 0; i < MAX_TEXTURES; i++ )
{
image = R_GetTexture( i );
if( j == start ) break; // found start
if( pglIsTexture( image->texnum )) j++;
}
if( i == MAX_TEXTURES && gl_showtextures->integer != 1 )
{
// bad case, rewind to one and try again
Cvar_SetFloat( "r_showtextures", max( 1, gl_showtextures->integer - 1 ));
if( ++numTries < 2 ) goto rebuild_page; // to prevent infinite loop
}
for( k = 0; i < MAX_TEXTURES; i++ )
{
if( j == end ) break; // page is full
image = R_GetTexture( i );
if( !pglIsTexture( image->texnum ))
continue;
x = k % base_w * w;
y = k / base_w * h;
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
GL_Bind( XASH_TEXTURE0, i ); // NOTE: don't use image->texnum here, because skybox has a 'wrong' indexes
if(( image->flags & TF_DEPTHMAP ) && !( image->flags & TF_NOCOMPARE ))
pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE );
pglBegin( GL_QUADS );
pglTexCoord2f( 0, 0 );
pglVertex2f( x, y );
if( image->flags & TF_TEXTURE_RECTANGLE )
pglTexCoord2f( image->width, 0 );
else pglTexCoord2f( 1, 0 );
pglVertex2f( x + w, y );
if( image->flags & TF_TEXTURE_RECTANGLE )
pglTexCoord2f( image->width, image->height );
else pglTexCoord2f( 1, 1 );
pglVertex2f( x + w, y + h );
if( image->flags & TF_TEXTURE_RECTANGLE )
pglTexCoord2f( 0, image->height );
else pglTexCoord2f( 0, 1 );
pglVertex2f( x, y + h );
pglEnd();
if(( image->flags & TF_DEPTHMAP ) && !( image->flags & TF_NOCOMPARE ))
pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB );
FS_FileBase( image->name, shortname );
if( Q_strlen( shortname ) > 18 )
{
// cutoff too long names, it looks ugly
shortname[16] = '.';
shortname[17] = '.';
shortname[18] = '\0';
}
Con_DrawString( x + 1, y + h - charHeight, shortname, color );
j++, k++;
}
CL_DrawCenterPrint ();
pglFinish();
}
//=======================================================
#endif // XASH_DEDICATED