1 
2 #include <stdio.h>
3 #include <math.h>
4 #include <signal.h>
5 #include <string.h>
6 
7 #include <SDL/SDL.h>
8 
9 #include "gl_struct.h"
10 
11 #include "doomdef.h"
12 
13 
14 /* ---------------------------------------------- */
15 /* --------- OpenGL function signatures --------- */
16 /* ---------------------------------------------- */
17 
18 void (*glBindTexture_s)    (GLenum target, GLuint texture);
19 void (*glMatrixMode_s)     (GLenum mode);
20 void (*glPushMatrix_s)     (void);
21 void (*glLoadIdentity_s)   (void);
22 void (*glRotatef_s)        (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
23 void (*glTranslatef_s)     (GLfloat x, GLfloat y, GLfloat z);
24 void (*glBegin_s)          (GLenum mode);
25 void (*glNormal3f_s)       (GLfloat nx, GLfloat ny, GLfloat nz);
26 void (*glTexCoord2f_s)     (GLfloat s, GLfloat t);
27 void (*glVertex3f_s)       (GLfloat x, GLfloat y, GLfloat z);
28 void (*glEnd_s)            (void);
29 void (*glPopMatrix_s)      (void);
30 void (*glCullFace_s)       (GLenum mode);
31 void (*glVertex2f_s)       (GLfloat x, GLfloat y);
32 void (*glColor3f_s)        (GLfloat red, GLfloat green, GLfloat blue);
33 void (*glDisable_s)        (GLenum cap);
34 void (*glEnable_s)         (GLenum cap);
35 void (*glClear_s)          (GLbitfield mask);
36 void (*glRasterPos2i_s)    (GLint x, GLint y);
37 void (*glColorTableEXT_s)  (GLenum target, GLenum internalformat, GLsizei width,
38 			                      GLenum format, GLenum type, const GLvoid *table);
39 void (*glDrawPixels_s)     (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
40 void (*glTexParameterf_s)  (GLenum target, GLenum pname, GLfloat param);
41 void (*glTexEnvf_s)        (GLenum target, GLenum pname, GLfloat param);
42 void (*glTexImage2D_s)     (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height,
43 			                      GLint border, GLenum format, GLenum type, const GLvoid *pixels);
44 void (*glOrtho_s)          (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
45 			                      GLdouble near_val, GLdouble far_val);
46 void (*glColor4f_s)        (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
47 void (*glAlphaFunc_s)      (GLenum func, GLclampf ref);
48 void (*glDepthFunc_s)      (GLenum func);
49 void (*glFinish_s)         (void);
50 void (*glReadPixels_s)     (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
51 			                      GLenum type, GLvoid *pixels);
52 const GLubyte*
53      (*glGetString_s)      (GLenum name);
54 void (*glViewport_s)       (GLint x, GLint y, GLsizei width, GLsizei height);
55 void (*glClearColor_s)     (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
56 void (*glClearDepth_s)     (GLclampf depth);
57 void (*glShadeModel_s)     (GLenum mode);
58 void (*glPixelStorei_s)    (GLenum pname, GLint param);
59 void (*glHint_s)           (GLenum target, GLenum mode);
60 void (*glBlendFunc_s)      (GLenum sfactor, GLenum dfactor);
61 void (*glDeleteTextures_s) (GLsizei n, const GLuint *textures);
62 void (*glMultMatrixd_s)    (const GLdouble *m);
63 void (*glTranslated_s)     (GLdouble x, GLdouble y, GLdouble z);
64 void (*glScalef_s)         (GLfloat x, GLfloat y, GLfloat z);
65 void (*glFrustum_s)        (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
66 			    GLdouble near_val, GLdouble far_val);
67 
68 
69 extern int             *a_iLineArray,*a_iLinePresent;
70 
71 #ifdef RASTER
72 extern float           fps;
73 extern long            lNbFrames;
74 extern GLboolean       g_bGlobalRaster;
75 #endif
76 
77 extern byte            *p_bPalette;
78 
79 char                   szAppName[]="GLHeretic";
80 
81 char                   *gl_Driver="libGL.so";
82 
83 int                    gldrv;
84 
85 extern char            *homedir;
86 char                   *mlump_filename;
87 char                   *wlump_filename;
88 
89 GLfloat                aspect;
90 
91 extern long            do_fullscreen;
92 
93 extern long            mouseLook;
94 
95 void                   fn_vChangeScreenResolution();
96 
97 GLboolean              g_b3Dfx=FALSE;
98 extern GLboolean       g_bPaletteTexture, g_bSpriteOpti, g_bSpriteBilinear;
99 extern GLboolean       g_bGlobalRaster, g_bDisplayRaster;
100 extern float           fScaleSprite;
101 extern int             iMaxSizeBeforeReduction;
102 extern float           fSpriteFilterDistanceCoeff;
103 
104 extern int             windowActive;
105 extern H_boolean       g_bMlook;
106 
107 extern void            GL_fn_vInitLights();
108 
109 
110 /*
111  * This function initializes all gl/glx functions.
112  */
113 
114 /* helper function */
sym_error(void)115 void sym_error(void) {
116   exit(1);
117 }
118 
fsym_error(char * func)119 void fsym_error(char* func) {
120   printf("[SDLGLDrv/init] an OpenGL-library without the \"%s\" function? :", func);
121   sym_error();
122 }
123 
load_init_gl_lib(char * driverlib_path)124 void load_init_gl_lib(char* driverlib_path) {
125   printf("[SDLGLDrv/init] Loading OpenGL-library: %s ...\n", driverlib_path);
126 
127   gldrv = SDL_GL_LoadLibrary(driverlib_path);
128 
129   printf("[SDLGLDrv/init] loaded OpenGL-library: %d \n", gldrv);
130 
131   if (gldrv != 0) {
132     printf("[SDLGLDrv/init] OpenGL-library \"%s\" couldn't be loaded !\n", driverlib_path);
133     sym_error();
134     printf("\n");
135   }
136 
137   glBindTexture_s=SDL_GL_GetProcAddress( "glBindTexture" );
138   if (!glBindTexture_s)
139   	fsym_error( "glBindTexture" );
140 
141   glMatrixMode_s=SDL_GL_GetProcAddress( "glMatrixMode" );
142   if (!glMatrixMode_s)
143   	fsym_error( "glMatrixMode" );
144 
145   glPushMatrix_s=SDL_GL_GetProcAddress( "glPushMatrix" );
146   if (!glPushMatrix_s)
147   	fsym_error( "glPushMatrix" );
148 
149   glLoadIdentity_s=SDL_GL_GetProcAddress( "glLoadIdentity" );
150   if (!glLoadIdentity_s)
151   	fsym_error( "glLoadIdentity" );
152 
153   glRotatef_s=SDL_GL_GetProcAddress( "glRotatef" );
154   if (!glRotatef_s)
155   	fsym_error( "glRotatef" );
156 
157   glTranslatef_s=SDL_GL_GetProcAddress( "glTranslatef" );
158   if (!glTranslatef_s)
159   	fsym_error( "glTranslatef" );
160 
161   glBegin_s=SDL_GL_GetProcAddress( "glBegin" );
162   if (!glBegin_s)
163   	fsym_error( "glBegin" );
164 
165   glNormal3f_s=SDL_GL_GetProcAddress( "glNormal3f" );
166   if (!glNormal3f_s)
167   	fsym_error( "glNormal3f" );
168 
169   glTexCoord2f_s=SDL_GL_GetProcAddress( "glTexCoord2f" );
170   if (!glTexCoord2f_s)
171   	fsym_error( "glTexCoord2f" );
172 
173   glVertex3f_s=SDL_GL_GetProcAddress( "glVertex3f" );
174   if (!glVertex3f_s)
175   	fsym_error( "glVertex3f" );
176 
177   glEnd_s=SDL_GL_GetProcAddress( "glEnd" );
178   if (!glEnd_s)
179   	fsym_error( "glEnd" );
180 
181   glPopMatrix_s=SDL_GL_GetProcAddress( "glPopMatrix" );
182   if (!glPopMatrix_s)
183   	fsym_error( "glPopMatrix" );
184 
185   glCullFace_s=SDL_GL_GetProcAddress( "glCullFace" );
186   if (!glCullFace_s)
187   	fsym_error( "glCullFace" );
188 
189   glVertex2f_s=SDL_GL_GetProcAddress( "glVertex2f" );
190   if (!glVertex2f_s)
191   	fsym_error( "glVertex2f" );
192 
193   glColor3f_s=SDL_GL_GetProcAddress( "glColor3f" );
194   if (!glColor3f_s)
195   	fsym_error( "glColor3f" );
196 
197   glDisable_s=SDL_GL_GetProcAddress( "glDisable" );
198   if (!glDisable_s)
199   	fsym_error( "glDisable" );
200 
201   glEnable_s=SDL_GL_GetProcAddress( "glEnable" );
202   if (!glEnable_s)
203   	fsym_error( "glEnable" );
204 
205   glClear_s=SDL_GL_GetProcAddress( "glClear" );
206   if (!glClear_s)
207   	fsym_error( "glClear" );
208 
209   glRasterPos2i_s=SDL_GL_GetProcAddress( "glRasterPos2i" );
210   if (!glRasterPos2i_s)
211   	fsym_error( "glRasterPos2i" );
212 
213   glColorTableEXT_s=SDL_GL_GetProcAddress( "glColorTableEXT" );
214   if (!glColorTableEXT_s)
215      /*fsym_error( "glColorTableEXT" )*/; /* kludge solaris ogl */
216 
217   glDrawPixels_s=SDL_GL_GetProcAddress( "glDrawPixels" );
218   if (!glDrawPixels_s)
219   	fsym_error( "glDrawPixels" );
220 
221   glTexParameterf_s=SDL_GL_GetProcAddress( "glTexParameterf" );
222   if (!glTexParameterf_s)
223   	fsym_error( "glTexParameterf" );
224 
225   glTexEnvf_s=SDL_GL_GetProcAddress( "glTexEnvf" );
226   if (!glTexEnvf_s)
227   	fsym_error( "glTexEnvf" );
228 
229   glTexImage2D_s=SDL_GL_GetProcAddress( "glTexImage2D" );
230   if (!glTexImage2D_s)
231   	fsym_error( "glTexImage2D" );
232 
233   glOrtho_s=SDL_GL_GetProcAddress( "glOrtho" );
234   if (!glOrtho_s)
235   	fsym_error( "glOrtho" );
236 
237   glColor4f_s=SDL_GL_GetProcAddress( "glColor4f" );
238   if (!glColor4f_s)
239   	fsym_error( "glColor4f" );
240 
241   glAlphaFunc_s=SDL_GL_GetProcAddress( "glAlphaFunc" );
242   if (!glAlphaFunc_s)
243   	fsym_error( "glAlphaFunc" );
244 
245   glDepthFunc_s=SDL_GL_GetProcAddress( "glDepthFunc" );
246   if (!glDepthFunc_s)
247   	fsym_error( "glDepthFunc" );
248 
249   glFinish_s=SDL_GL_GetProcAddress( "glFinish" );
250   if (!glFinish_s)
251   	fsym_error( "glFinish" );
252 
253   glReadPixels_s=SDL_GL_GetProcAddress( "glReadPixels" );
254   if (!glReadPixels_s)
255   	fsym_error( "glReadPixels" );
256 
257   glGetString_s=SDL_GL_GetProcAddress( "glGetString" );
258   if (!glGetString_s)
259   	fsym_error( "glGetString" );
260 
261   glViewport_s=SDL_GL_GetProcAddress( "glViewport" );
262   if (!glViewport_s)
263   	fsym_error( "glViewport" );
264 
265   glClearColor_s=SDL_GL_GetProcAddress( "glClearColor" );
266   if (!glClearColor_s)
267   	fsym_error( "glClearColor" );
268 
269   glClearDepth_s=SDL_GL_GetProcAddress( "glClearDepth" );
270   if (!glClearDepth_s)
271   	fsym_error( "glClearDepth" );
272 
273   glShadeModel_s=SDL_GL_GetProcAddress( "glShadeModel" );
274   if (!glShadeModel_s)
275   	fsym_error( "glShadeModel" );
276 
277   glPixelStorei_s=SDL_GL_GetProcAddress( "glPixelStorei" );
278   if (!glPixelStorei_s)
279   	fsym_error( "glPixelStorei" );
280 
281   glHint_s=SDL_GL_GetProcAddress( "glHint" );
282   if (!glHint_s)
283   	fsym_error( "glHint" );
284 
285   glBlendFunc_s=SDL_GL_GetProcAddress( "glBlendFunc" );
286   if (!glBlendFunc_s)
287   	fsym_error( "glBlendFunc" );
288 
289   glDeleteTextures_s=SDL_GL_GetProcAddress( "glDeleteTextures" );
290   if (!glDeleteTextures_s)
291   	fsym_error( "glDeleteTextures" );
292 
293   glMultMatrixd_s=SDL_GL_GetProcAddress( "glMultMatrixd" );
294   if (!glMultMatrixd_s)
295   	fsym_error( "glMultMatrixd" );
296 
297   glTranslated_s=SDL_GL_GetProcAddress( "glTranslated" );
298   if (!glTranslated_s)
299   	fsym_error( "glTranslated" );
300 
301   glScalef_s=SDL_GL_GetProcAddress( "glScalef" );
302   if (!glScalef_s)
303   	fsym_error( "glScalef" );
304 
305   glClearDepth_s=SDL_GL_GetProcAddress( "glClearDepth" );
306   if (!glClearDepth_s)
307   	fsym_error( "glClearDepth" );
308 
309   glFrustum_s=SDL_GL_GetProcAddress( "glFrustum" );
310 	if (!glFrustum_s)
311 		fsym_error( "glFrustum" );
312 }
313 
314 
315 /*
316  * ----------------------------------------------------------------
317  * Memory (this Code should work for all systems now)
318  * ----------------------------------------------------------------
319  */
320 
321 int g_hHeap=-1, g_hHeapFix=-1;
322 char g_cMemMode=FIX;
323 
fn_vSetMemoryMode(char type)324 void fn_vSetMemoryMode(char type) {
325   g_cMemMode=type;
326   /* fprintf(stderr, "fn_vSetMemoryMode: g_cMemMode: %d\n", g_cMemMode); */
327 }
328 
fn_vInitMemory(unsigned int dwSize)329 void fn_vInitMemory(unsigned int dwSize) {
330   /* fprintf(stderr, "fn_vInitMemory -begin- g_cMemMode: %d.\n", g_cMemMode); */
331   if (g_cMemMode==FIX)
332     g_hHeapFix=HeapCreate(FIX);
333   else
334     g_hHeap=HeapCreate(LEVEL);
335 
336   /* fprintf(stderr, "fn_vInitMemory -end- g_cMemMode: %d.\n", g_cMemMode); */
337 }
338 
fn_vDesinitMemory()339 void fn_vDesinitMemory() {
340   int hHeap=(g_cMemMode==FIX ? g_hHeapFix : g_hHeap);
341 
342   /*fprintf(stderr, "fn_vDesinitMemory: hHeap: %d  ; g_cMemMode: %d  ; g_hHeapFix: %d  ; g_hHeap: %d\n",
343 	  hHeap, g_cMemMode, g_hHeapFix, g_hHeap); */
344 
345   if (hHeap==-1)
346     return;
347   HeapDestroy(hHeap);
348   if (g_cMemMode==FIX)
349     g_hHeapFix=-1;
350   else
351     g_hHeap=-1;
352 
353   /* fprintf(stderr, "fn_vDesinitMemory called.\n"); */
354 }
355 
GLMalloc(unsigned int dwNbBytes)356 void *GLMalloc(unsigned int dwNbBytes)	/* Heap */
357 {
358   void *memory = NULL;
359   int hHeap=(g_cMemMode==FIX ? g_hHeapFix : g_hHeap);
360 
361   memory=HeapAlloc(hHeap, 0, dwNbBytes);
362 
363   /* fprintf(stderr, "GLMalloc called.\n"); */
364   return memory;
365 }
366 
GLRealloc(void * lpMem,unsigned int dwBytes)367 void *GLRealloc(void *lpMem, unsigned int dwBytes) {
368   void *memory = NULL;
369   int hHeap=(g_cMemMode==FIX ? g_hHeapFix : g_hHeap);
370 
371   if (!lpMem) {
372     fprintf(stderr, "[SDLGLdrv/init] Attempt to realloc NULL pointer");
373     return FALSE;
374   }
375   else {
376     memory=HeapReAlloc(hHeap, 0, lpMem, dwBytes);
377 
378     /* fprintf(stderr, "GLRealloc called.\n"); */
379     return memory;
380   }
381 }
382 
GLFree(void * lpMem)383 void GLFree(void *lpMem) {
384   int hHeap=(g_cMemMode==FIX ? g_hHeapFix : g_hHeap);
385   return HeapFree(hHeap, 0, &lpMem);
386 
387   /* fprintf(stderr, "GLFree called.\n"); */
388 }
389 
390 
I_GL_InitGraphics(void)391 void I_GL_InitGraphics(void) {
392   int value, flags;
393 
394   if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
395     fprintf(stderr,"[SDLGLDrv] Couldn't initialize SDL: %s\n",SDL_GetError());
396     exit( 1 );
397   }
398 
399   /* do fullscreen ? */
400   if (do_fullscreen)
401     flags = SDL_OPENGL | SDL_FULLSCREEN;
402   else
403     flags = SDL_OPENGL;
404 
405   /*
406    * load and init OpenGL driver
407    */
408   load_init_gl_lib(gl_Driver);
409 
410   /* set OpenGL attributes */
411   SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
412   SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 6 );
413   SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
414   SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
415   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
416 
417   signal(SIGINT, (void (*)(int)) I_Quit);
418 
419   mlump_filename=(char*)malloc(strlen(homedir)+strlen("Mlump.txt")+1);
420   sprintf(mlump_filename, "%sMlump.txt", homedir);
421 
422   wlump_filename=(char*)malloc(strlen(homedir)+strlen("Wlump.txt")+1);
423   sprintf(wlump_filename, "%sWlump.txt", homedir);
424 
425   if ( SDL_SetVideoMode( screenwidth, screenheight, 16, flags ) == NULL ) {
426     fprintf(stderr, "[SDLGLdrv/init] Couldn't set GL mode: %s\n",
427 	    SDL_GetError());
428     SDL_Quit();
429     exit(1);
430   }
431 
432   /* check request results */
433   SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &value );
434   printf( "[SDLGLDrv/init] red_size: requested 5 bits, got %d\n", value );
435   SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &value );
436   printf( "[SDLGLDrv/init] green_size: requested 6 bits, got %d\n", value);
437   SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, &value );
438   printf( "[SDLGLDrv/init] blue_size: requested 5 bits, got %d\n", value );
439   SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &value );
440   printf( "[SDLGLDrv/init] depth_size: requested 16 bits, got %d\n", value );
441   SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value );
442   printf( "[SDLGLDrv/init] OpenGL_doublebuffer: requested 1, got %d\n", value );
443 
444   /* Set the window manager title bar */
445   SDL_WM_SetCaption( "GLHeretic v1.1", "GLHeretic" );
446 
447   /* hide the mouse-cursor */
448   SDL_ShowCursor( 0 );
449 
450   initializeGL(screenwidth, screenheight);
451 }
452 
453 
454 /*
455  * ----------------------------------------------------------------
456  * OpenGL code
457  * ----------------------------------------------------------------
458  */
459 
DisplayGLInfo()460 void DisplayGLInfo() {
461     const unsigned char *vendor=(*glGetString_s) (GL_VENDOR);
462     const unsigned char *version=(*glGetString_s) (GL_VERSION);
463     unsigned char str[1]={0};
464     const unsigned char *renderer=(*glGetString_s) (GL_RENDERER);
465     const unsigned char *extension=str;
466 
467     extension=(*glGetString_s) (GL_EXTENSIONS);
468     printf("[SDLGLdrv/init] OpenGL driver: %s (%s) %s\n", version, vendor, renderer);
469     printf("[SDLGLdrv/init] OpenGL Extensions: %s\n", extension);
470     if (!strstr((char *)extension,"GL_EXT_paletted_texture")) {
471       g_bPaletteTexture=FALSE;
472       printf("[SDLGLdrv/init] OpenGL driver doesn't support paletted textures\n");
473     }
474 }
475 
resize(GLsizei width,GLsizei height)476 GLvoid resize( GLsizei width, GLsizei height ) {
477   (*glViewport_s) (0, 0, width, height);
478 }
479 
initializeGL(GLsizei width,GLsizei height)480 GLvoid initializeGL(GLsizei width, GLsizei height) {
481 
482   aspect = (GLfloat)width/(GLfloat)height;
483 
484   DisplayGLInfo();
485 
486   p_bPalette=W_CacheLumpName("PLAYPAL", PU_STATIC); /* DOOM_GL */
487 
488   (*glClearColor_s) (0.0f, 0.0f, 0.0f, 0.0f);
489   (*glClearDepth_s) (1.0);
490   (*glDepthFunc_s) (GL_LEQUAL);
491   (*glShadeModel_s) (GL_SMOOTH);
492 
493   /* enable */
494   (*glEnable_s) (GL_DEPTH_TEST);
495 
496   (*glPixelStorei_s) (GL_UNPACK_ALIGNMENT, 1);
497 
498   (*glHint_s) (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
499 
500   /* if you want it really NICE (and have a fast OpenGL-card) ! */
501 #ifdef NICE_GL
502   (*glHint_s) (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
503 #else
504   (*glHint_s) (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
505 #endif
506 
507   fn_vInitGLTexFonts();
508 
509   if (!screen)
510     screen=(byte *)malloc(screenwidth*screenheight*4);
511 
512 
513   GL_fn_vInitLights();
514 #ifdef WEAP_DRAWPIX
515   fn_vAllocWeaponMemory();
516 #endif
517   /* MR3006: DynLight (test) */
518   /* GL_AddLightSource(0,0,0,0,0,1,0,0,10.0f); */
519 
520   /* Fog... */
521   /* (*glEnable_s) (GL_FOG); */
522 }
523 
524 extern H_boolean g_bLightEffects;
525 
GL_InitCommandLine()526 void GL_InitCommandLine() {
527   int p;
528 
529   if ((p=M_CheckParm("-gl_driver"))) {
530     gl_Driver=(char*)malloc(strlen(myargv[p+1])+1);
531     strcpy(gl_Driver, myargv[p+1]);
532     printf("[SDLGLDrv] OpenGL: using %s as gl_Driver.\n", gl_Driver);
533   }
534 
535   if (M_CheckParm("-paltex")) {
536     g_bPaletteTexture=TRUE;
537     printf("[SDLGLDrv] OpenGL: Paletted textures enabled\n");
538   }
539 
540   g_bSpriteBilinear=TRUE;
541   printf("[SDLGLDrv] OpenGL: Sprite filtering enabled\n");
542 
543   g_bSpriteOpti=TRUE;
544   printf("[SDLGLDrv] OpenGL: Sprite compression enabled\n");
545 
546   if ((p=M_CheckParm("-sprscale")))
547     fScaleSprite=(float)atof(myargv[p+1]);
548 
549   if ((p=M_CheckParm("-sprmaxsurf"))) {
550     iMaxSizeBeforeReduction=atoi(myargv[p+1]);
551     printf("[SDLGLDrv] OpenGL: Sprite maximum surface: %d\n",iMaxSizeBeforeReduction);
552     printf("[SDLGLDrv] OpenGL: Sprite factor scale: %f\n",fScaleSprite);
553   }
554 
555   if ((p=M_CheckParm("-raster"))) {
556     g_bGlobalRaster=TRUE;
557   }
558 
559   if ((p=M_CheckParm("-dspraster"))) {
560     g_bDisplayRaster=TRUE;
561   }
562 
563   if ((p=M_CheckParm("-3dfx"))) {
564     g_b3Dfx=TRUE;
565     printf("[SDLGLDrv] OpenGL: Max texture size is 256x256\n");
566   }
567 
568   if ((p=M_CheckParm("-fullscreen"))) {
569     do_fullscreen=1;
570     printf("[SDLGLDrv] OpenGL: running in fullscreen mode\n");
571   }
572 
573   if ((p=M_CheckParm("-window"))) {
574     do_fullscreen=0;
575     printf("[SDLGLDrv] OpenGL: running in windowed mode\n");
576   }
577 
578   if (mouseLook)
579      g_bMlook = TRUE;
580   else
581      g_bMlook = FALSE;
582 
583   if (!M_CheckParm("-noeffects"))	/* DarkFang */
584     g_bLightEffects=TRUE;
585   else
586     g_bLightEffects=FALSE;
587 }
588